All notable changes to this project will be documented in this file, in reverse chronological order by release..
- Nothing.
- Nothing.
- Nothing.
- #72 ensures that streams used to serialize request/response instances are both readable and seekable.
- #74 updates PHPUnit to >= 4.6.
- #75 updates the
Servertests to flush output after calls tolisten()so that PHPUnit will see the output. Additionally, it modifiesServerto pass the current output buffer level to the emitter.
- #67 adds two new feature:
- Response emitters.
Phly\Http\Response\EmitterInterfacedefines the contract for emitters, with the single methodemit(). A single concrete emitter is provided,Phly\Http\Response\SapiEmitter.Phly\Http\Servernow composes an emitter, using theSapiEmitterby default. - Serializers.
Phly\Http\Request\SerializerandPhly\Http\Response\Serializerprovide the following static methods:fromString($message)will parse the given message string and return the appropriate message instance.fromStream(Psr\Http\Message\StreamInterface $stream)will parse the given message stream and return the appropriate message instance.toString(Psr\Http\Message\RequestInterface|Psr\Http\MessageResponseInterface $message)will return a string representation of the given message instance.
- Response emitters.
- A
CONTRIBUTING.mdfile was added.
- Nothing.
- Nothing.
- Documentation was updated to ensure all components of the package are documented. Documentation that duplicates PSR-7 was removed.
- #65 adds a "provides" section to
the
composer.json, with the packagepsr/http-message-implementation, which indicates a virtual package. Packages may list the virtual package as a dependency, and this package, or any other PSR-7 implementation, will then fulfill it.
- Nothing.
- Nothing.
- #66 updates the
Stream::attach()method docblock; the method is not inherited, so needed full documentation. - #68 updates the
psr/http-messagerequirement to~1.0, as PSR-7 is now accepted!
- Nothing.
- Nothing.
- Nothing.
- Updated the
psr/http-messagedependency to look for^0.11, allowing it to pick up bugfix releases.
This release contains the following security fix:
- Zend Framework ZF2015-04
detailed HTTP Response Splitting vectors that are possible via HTTP headers,
when unfiltered input containing multiple CRLF (
\r\n) sequences are present. This release contains a patch for the issue, based on the one used in Zend Framework 2.
- Nothing.
- Nothing.
- Nothing.
- #59 corrects the exception message
thrown from
Stream::read()to use the verbiage "read" instead of "write". - #62 ensures that
Uri::parseUri()raises an exception whenparse_url()fails. - #63 patches CRLF message splitting
vectors in the request and response implementations. It adds a new class,
Phly\Http\HeaderSecurity, which can be used to validate or filter header values, and which is used internally to assert valid header values.
This release is BACKWARDS IN-COMPATIBLE with previous releases.
psr/http-message 0.11.0 renames the method
Psr\Http\UploadedFileInterface::move() to moveTo(), which presents a
backwards compatibility break.
Phly\Http\UploadedFile::moveTo(), which allows moving an uploaded file to a given path as represented by a valid PHP stream/filename.
- Nothing.
Phly\Http\UploadedFile::move(), which was replaced with themoveTo()method.
Phly\Http\Response::getReasonPhrase()now always returns a string, even in cases where the reason phrase is undefined (in which case it will be an empty string).Phly\Http\Response::withStatus()now defines the default value of the$reasonPhraseargument as an empty string.
This release is BACKWARDS IN-COMPATIBLE with previous releases. This is in large part due to massive changes between psr/http-message 0.9 and 0.10, which include:
- Renaming
Psr\Http\Message\StreamableInterfacetoPsr\Http\Message\StreamInterface. This will not affect most consumers, but it does change the signature of thegetBody()andwithBody()methods of both requests and responses. Psr\Http\Message\UriInterfacenow allows empty paths and relative paths, which changes the behavior ofUri::getPath().Psr\Http\Message\MessageInterfacerenamed one method and changed the behavior of another method with regard to headers:getHeader($name)now returns an array of values.getHeaderLines($name)was renamed togetHeaderLine($name), and now returns a string ornull.
Psr\Http\Message\StreamInterfacenow uses exceptions for reporting error conditions instead of multiple return values.Psr\Http\Message\RequestInterface::withUri()defines an additional, optional parameter,$preserveHost; whentrue, the message MUST NOT change the value of theHostheader; whenfalse, it MUST change the value to correspond with the value in the URI.Psr\Http\Message\ServerRequestInterfacerenamesgetFileUploads()togetUploadedFiles(), and adds a mutator method,withFileUploads(). The structure of this property MUST be a tree with each leaf an instance of a new interface,Psr\Http\Message\UploadedFileInterface.
Due to the above changes, a number of changes were made to phly/http.
Phly\Http\UploadedFile, which is an implementation ofPsr\Http\Message\UploadedFileInterface, and provides metadata around an uploaded file, as well as behavior for retrieving aPsr\Http\Http\StreamInterfacerepresenting the upload and for moving the file to its target destination in an SAPI-agnostic way.Phly\Http\ServerRequestFactory::normalizeFiles(), which will normalize an array of files to a tree ofPhly\Http\UploadedFileinstances, including normalization of upload file arrays.Phly\Http\ServerRequest::getUploadedFiles(), for returning the normalized uploaded files tree.Phly\Http\ServerRequest::withUploadedFiles(), for returning a new instance containing the uploaded files.Phly\Http\Uri::getHeaderLine($name), which returns the comma-concatenated values for the given header.
- Nothing.
Phly\Http\ServerRequest::getFileParams(), which was replaced with thegetUploadedFiles()method.Phly\Http\Uri::getHeaderLines(), which was renamed togetHeaderLine(), with different behavior.
Phly\Http\Uri::withPath()now defines and accepts the$preserveHostargument, as outlined in this version's overview summary.Phly\Http\Uri::getHeader()now returns an array of values associated with the header; an empty array is returned if the header is not defined.Phly\Http\Streamnow raisesInvalidArgumentExceptionandRuntimeExceptionwhen unable to perform work, instead of overloading the return value.
- Nothing.
- Nothing.
- Nothing.
- #52 Replace
self::withstatic::and@return selfwith@return staticto allow for late static binding with class extensions. - #55 Updates
parseUri()to validate the scheme, ensuring theUriinstance cannot be instantiated with an invalid scheme. - #54 Internal restructuring to allow
serialization of a
Uriinstance.
- Nothing.
- Nothing.
- Nothing.
- #51 Ensure all
with*()methods return a new instance, as specified (and not$this, even when no change is created).
- Nothing.
- Nothing.
- Nothing.
- #39 Always attempt to return a Host header from a request if a URI is composed containing a host. This will be true for client-side requests only; server-side will only represent what was present in the incoming request.
- #40 Ensure that path, query string, and fragment are each properly encoded, but also prevent against double encoding of values.
- #48 Cache generated URI string after first generation.
- #42 Updated
Stream::getSize()to return the stream size if a resource is composed. - #41 Fixed examples in README to reflect updates in API.
- #44 Retain case sensitivity for
header names (when returned via
getHeaders(). - #45 Fix port numeric comparison to properly accept port integers specified via strings.
- #46 and #47 Fix install instructions to ensure dependencies are resolved properly.
This release contains one backwards incompatible change. The upstream
psr/http-message's ServerRequestInterface renamed the following methods:
getBodyParams()was renamed togetParsedBody().withBodyParams()was renamed towithParsedBody().
Additionally, withParsedBody() removes the array typehint.
Phly\Http\ServerRequest::getParsedBody()(replacesgetBodyParams())Phly\Http\ServerRequest::withParsedBody()(replacesgetBodyParams())
- Nothing.
Phly\Http\ServerRequest::getBodyParams()(replaced withgetParsedBody())Phly\Http\ServerRequest::withBodyParams()(replaced withgetParsedBody())
Phly\Http\ServerRequestFactorywas updated to callwithParsedBody()when seeding parsed body data.- #34 Fix
Phly\Http\Responsedocblocks to mirror those of psr/http-message. - #35 Remove unused variable from test bootstrap.
- #37 Rename
phpunit.xmltophpunit.xml.dist.
- Nothing.
- Nothing.
- Nothing.
- #31 corrects the unit test suite to read "Http", and not "Conduit".
- Nothing.
- Nothing.
- Nothing.
- A patch was added to ensure the request-target is always recalculated if not set explicitly.
This release is backwards incompatible with 0.9.X. It updates its psr/http-message dependency to 0.7.0, which introduces the following changes:
Psr\Http\Message\UriTargetInterfacewas renamed toPsr\Http\Message\UriInterface;Phly\Http\Uriwas updated to reflect this change, as wasPhly\Http\Request.Psr\Http\Message\UriInterfaceremoves the methodsisOrigin(),isAbsolute(),isAuthority(), andisAsterisk(), andPhly\Http\Uridoes likewise.Psr\Http\Message\RequestInterfaceadds the methodsgetRequestTarget()andwithRequestTarget($requestTarget);Phly\Http\Requestwas updated to add these.
Unless you were using the methods removed from Phly\Http\Uri, this update
should pose no challenges to upgrading.
Phly\Http\Request::getRequestTarget(), which retrieves the request-target. By default, it uses the URI composed in the request to provide a request-target in origin-form (and the string "/" if no URI is present or the URI has no path).Phly\Http\Request::withRequestTarget($requestTarget), which creates a new instance with the specified request-target. If the request-target contains any whitespace, the method raises an exception.
- Nothing.
Phly\Http\Uri::isOrigin()Phly\Http\Uri::isAbsolute()Phly\Http\Uri::isAuthority()Phly\Http\Uri::isAsterisk()
- Nothing.
- Now tests against HHVM (and passes!).
- Many more tests, particularly against
Stream,ServerRequestFactory, andUri.
- Nothing.
ServerRequestFactory::fromServer(); this should have been removed in 0.9.0, and was only raising an exception anyways.
Stream::attach()was not assigning the resource to the instance; it now does.Uri::__construct()was creating an error condition instead of an exception when a non-string URI was provided.
This release breaks compatibility with regards to the "final handler" callable
used with Server::listen(). It was previously documented that such a callable
should have the signature:
function ($err = null) {
}phly/conduit was the primary consumer of
this, and used it as a $next argument. However, the semantics of $next
changed in 0.11.0 to always require a request and response, and moves the
$error argument to an optional third argument:
function ($request, $response, $err = null) {
}This release adds a test to validate the behavior, which wasn't previously tested, and updates the documentation to reflect the above.
- Nothing.
- Nothing.
- Nothing.
Server::listen()'s optional$finalHandlerargument now has an updated signature offunction ($req, $res, $err = null).
- Nothing.
- Nothing.
- Nothing.
- #23 and #24 detailed several use cases where empty paths and root paths were not being represented correctly. The correct, normalized form of an origin-form or absolute-form request-target is that an empty path should be represented by a "/". As of this release, this is now correct.
- Nothing.
- Nothing.
- Nothing.
- Updated
Phly\Http\Urito allow empty paths (previously, it had prefixed even empty paths with a "/").
- Nothing.
- Nothing.
- Nothing.
- Updated
Phly\Http\Urito work under PHP 5.4. (Failed previously due to callingempty()on method calls.)
- Nothing.
- Nothing.
- Nothing.
- Updated README.md to reference
psr/http-message:~0.6.0, as that's the minimum version with which the 0.8 series will work.
This version is for most intents and purposes a complete rewrite. It reverts in many respects to the implementations in the 0.6 series:
Phly\Http\RequestPhly\Http\ResponsePhly\Http\ServerRequest(which wasIncomingRequestin 0.6)
However, the messages are now immutable, and setters have been renamed to use
with and without verbiage to better imply that they now return a new
instance, and do not change state on the given instance on which the method was
called. Constructors have been rewritten to accept the most common arguments
first, and to accept all message properties. (The exception to this is that
Phly\Http\ServerRequest only accepts the $_SERVER and $_FILES
superglobals; all others must be injected via the mutators.)
Additionally, this release updates Phly\Http\Uri to follow the
psr/http-message >= 0.6.0 Psr\Http\Message\UriTargetInterface definition,
which breaks backwards compatibility. The new implementation remains immutable,
but now defines methods for all URI segments.
Phly\Http\Request.Phly\Http\Response.Phly\Http\ServerRequest, which replacesPhly\Http\IncomingRequest.Phly\Http\ServerRequestFactory, which replacesPhly\Http\IncomingRequestFactory.
- Nothing.
Phly\Http\IncomingRequest(replaced byPhly\Http\ServerRequest).Phly\Http\OutgoingRequest.Phly\Http\IncomingResponse.Phly\Http\OutgoingResponse.Phly\Http\IncomingRequestFactory(replaced byPhly\Http\ServerRequestFactory).
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #20 Fixes
IncomingRequest::setUrl()to ensure it uses theUriinstance when setting the property, and not the string URL. - #17 Fixes a typo in the README, and demonstrates instantiating an
OutgoingResponseprior to consuming it.
- Nothing.
- Nothing.
- Nothing.
- README.md file now reflects actual API and presents client-side use cases.
Updated component to psr/http-message 0.5.1. That release contains a number of backwards-incompatible changes:
Phly\Http\RequestandPhly\Http\Responsewere removed.Phly\Http\MessageTraitwas altered to provide only accessors.Phly\Http\IncomingResponse,Phly\Http\OutgoingResponse, andPhly\Http\OutgoingRequestwere added, providing segregation between client-side and server-side request/response pairs, and marking "incoming" variants as immutable. This necessitated addingPhly\Http\RequestTrait,Phly\Http\ResponseTrait,Phly\Http\WritableMessageTrait, andPhly\Http\ImmutableHeadersTraitto reduce code duplication and codify commonalities between different types.
Phly\Http\WritableMessageTraitwas added, and contains mutator (setter) methods for the properties defined inPhly\Http\MessageTrait.setBody()no longer allows setting anullvalue.Phly\Http\ImmutableHeadersTraitwas added, and contains a private mutator (setter) method for populating the headers of a message; this will typically be composed into an immutable message type to allow setting headers via the constructor in a normalized fashion.Phly\Http\RequestTraitwas added, defining accessors (getters) for request instances: the request method and url.Phly\Http\ResponseTraitwas added, defining accessors (getters) for response instances: the status code and reason phrase.Phly\Http\IncomingRequest::__construct()was modified to allow providing the url, request method, headers, and$_SERVERvalues. Please note the change in constructor arguments when populating an incoming request instance manually.Phly\Http\IncomingRequest::getAttribute($attribute, $default = null)was added to allow easy retrieval of a single attribute value.Phly\Http\IncomingRequest::setAttribute($attribute, $value)was added to allow easy setting of a single attribute value.Phly\Http\OutgoingResponsewas added, as the complement toPhly\Http\IncomingRequest. It is fully mutable.Phly\Http\OutgoingRequestwas added, for making client-side HTTP requests. It is fully mutable.Phly\Http\IncomingResponsewas added, as a complement toPhly\Http\OutgoingRequest, and represents the response returned from such a request. It is immutable, and all values must be set via the constructor.
Phly\Http\OutgoingRequest::setUrl()no longer allows passing aPhly\Http\Uri(or an other object) instance; only strings are allowed.Phly\Http\RequestTrait::getUrl()no longer returns aPhly\Http\Uriinstance, only strings.Phly\Http\IncomingRequestFactory::fromServer(); since all values of a request must be added during instantiation, this method no longer made sense for marshaling values for an existing request instance. This method now throwsPhly\Http\IncomingRequestFactory::marshalUri(); we can no longer assume we have a request instance, only headers. As such,Phly\Http\IncomingRequestFactory::marshalUriFromServer()is now preferred as it uses the header values instead (marshalUri()now proxies to this method).Phly\Http\IncomingRequestFactory::marshalHostAndPort(); we can no longer assume we have a request instance, only headers. As such,Phly\Http\IncomingRequestFactory::marshalHostAndPortFromHeaders()is now preferred as it uses the header values instead (marshalHostAndPort()now proxies to this method).
- All mutator methods (setters) were removed from
Phly\Http\MessageTrait. Phly\Http\Requestwas removed.Phly\Http\Responsewas removed.Phly\Http\IncomingRequest::setCookieParams()was removed.Phly\Http\IncomingRequest::setBodyParams()was removed.
- CS issues.
- Removed obsolete tests.
Updated component to psr/http-message 0.4.0. That release contains a number of backwards-incompatible changes.
- Added IncomingRequestFactory::setHeaders() for simplifying setting (overwriting) many headers at once from an array.
- Updated MessageTrait::addHeader() to allow array values
- Modified IncomingRequest to
s/PathParams/Attributes/g
- IncomingRequest now only allows arrays for either input or return values; Array-like objects are no longer accepted.
- Removed ability to pass objects to MessageTrait::addHeader()/setHeader()
- Removed setHeaders()/addHeaders() from MessageTrait
- Modified IncomingRequest to
s/PathParams/Attributes/g
- Removed ability to pass objects to MessageTrait::addHeader()/setHeader()
- Removed setHeaders()/addHeaders() from MessageTrait
- Modified IncomingRequest to
s/PathParams/Attributes/g
- #11 Moved
PhlyTestautoloader configuration toautoload-devkey, as it is needed for development purposes only.
This release has some backwards incompatible breaks, including:
Phly\Http\Requestno longer accepts an HTTP protocol version as a constructor argument. UsesetProtocolVersion()instead.Phly\Http\Requestnow usesphp://memoryas the default body stream. (IncomingRequestusesphp://inputas the default stream.)Phly\Http\RequestFactoryhas been renamed toPhly\Http\IncomingRequestFactory- It also now expects an
IncomingRequestInterfaceif passed a request object to populate.
- It also now expects an
Phly\Http\Server::createServer()now expects 4 additional arguments:$query, usually$_GET$body, usually$_POST$cookies, usually$_COOKIE$files, usually$_FILES
Phly\Http\Servernow composes aPsr\Http\Message\IncomingRequestInterfaceinstance, not aPsr\Http\Message\RequestInterfaceinstance. This has the implication that all handlers will now receive more specifically anIncomingRequest. The change affects each of the following method signatures:__construct()createServer()createServerFromRequest()
Phly\Http\MessageTrait::setProtocolVersion($version), per changes in PSR-7 (this is now defined in theMessageInterface).- Note in
Phly\Http\Stream::read()'s@returnannotation indicating that it can also return booleanfalse. Phly\Http\IncomingRequest, which implementsPsr\Http\Message\IncomingRequestInterfaceand provides a server-side request implementation with accessors for each type of request datum typically accessed (cookies, matched path parameters, query string arguments, body parameters, and upload file information). It usesphp://inputas the default body stream.Phly\Http\IncomingRequestFactory(which replacesPhly\Http\RequestFactory)fromGlobals($server, $query, $body, $cookies, $files)factory method for creating anIncomingRequestinstance from superglobals; all arguments are optional, and, if not provided, will be derived from the relevant superglobal.
Phly\Http\Server::createServer()now expects 4 additional arguments:$query, usually$_GET$body, usually$_POST$cookies, usually$_COOKIE$files, usually$_FILES
Phly\Http\Requestno longer accepts an HTTP protocol version as a constructor argument. UsesetProtocolVersion()instead.Phly\Http\Serverno longer works with standardPsr\Http\Message\RequestInterfaceimplementations; it requiresPsr\Http\Message\IncomingRequestInterfaceimplementations.
Phly\Http\RequestFactory(it is nowPhly\Http\IncomingRequestFactory)
Phly\Http\Stream::read()now returns boolean false when the stream is not readable, or no resource is present.
- Ability for header values to allow objects that can be cast to strings. This allows for header objects representing complex values to generate the value.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #8 Update README.md to remove references to methods and interfaces that have been removed.
- Updated README.md to reference
~0.2.0@devas the psr/http-message version when installing via Composer.
- Nothing.
- Nothing.
- Nothing.
- Updated implementation to psr/http-message 0.2.0, which:
- Renames StreamInterface to StreamableInterface
- Adds attach() and getMetadata($key = null) to the stream interface
- Removes the $maxLength argument from the getContents() method of the stream interface
- Nothing.
- Nothing.
- Nothing.
- Pinned to 0.1.0 of psr/http-message; v0.2.0 introduces breaking changes, which will require updates to this library before we can consume them.
- Nothing.
- Nothing.
- Nothing.
- #5
Phly\Http\Server::sendHeadersnow always sends multiple header lines if a header has multiple values.
- Nothing.
- Nothing.
- Nothing.
Phly\Http\Urinow importsInvalidArgumentException.
Adds a php://input-specific stream implementation to ensure it's always regarded as read-only, and to implement caching.
Phly\Http\PhpInputStream
- Nothing.
- Nothing.
Phly\Http\Requestnow creates aPhly\Http\PhpInputStreamby default.
Reworks the implementation to strictly follow the PSR HTTP message interfaces. This includes:
- Removing property overloading from the request implementation.
- Removing
Phly\Http\ResponseInterface, and the related method implementations in the concrete response implementation.
The removed features can be added via decoration or implementing additional interfaces in individual projects using the implementations.
Phly\Http\MessageTrait(implementsPsr\Http\Message\MessageInterface).
Phly\Http\ResponseInterface
Phly\Http\AbstractMessage(usePhly\Http\MessageTraitnow).Phly\Http\ResponseInterface.- Methods in
Phly\Http\Responsethat implementedPhly\Http\ResponseInterface. - Property overloading in
Phly\Http\RequestInterface.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #1 fixes an issue where
%symbols could raise errors and result in no output. This was due to usingprintfto emit output, which was chosen for testing reasons; however, this had the aforementioned side effect. Tests were updated to use PHPUnit'sexpectOutputString()method for testing output, andServer::send()was modified to useechoinstead ofprintf().
Initial release.