All notable changes to this project will be documented in this file, in reverse chronological order by release..
- Nothing.
- Nothing.
- Nothing.
- Modified
composer.json
to require onlypsr/http-message
, suggestpsr/http-message-implementation
, and, in development, requirephly/http
; this allows substitution of PSR-7 implementations.
- Nothing.
- Nothing.
- Nothing.
- #41 Simplified logic when determining "final" handler to execute.
This release updates Conduit to use phly/http 0.12, containing updates to the PSR-7 specification as of 13 April 2015. The specifics that affect Conduit include:
RequestInterface::withUri()
now has an additional parameter,$preserveHost
; whenfalse
(the default), the request'sHost
header is updated with the host component of the provided URI; this affected thePhly\Conduit\Http\Request
definition.StreamableInterface
was renamed toStreamInterface
. This affected both thePhly\Conduit\Http\Request
andPhly\Conduit\Http\Response
definitions.UriInterface
now allows both relative and empty paths.
This last forced a BC break in Conduit, as the previous behavior was that paths
MUST be prefixed with /
. As a result, MiddlewarePipe
now normalizes paths to
always prepend a /
, and to trim any trailing /
characters.
- Nothing.
- Nothing.
- Nothing.
- #39 PSR-7 "Review 2" support.
- Nothing.
- Nothing.
- Nothing.
- #37 Improved install instructions.
- #38 Fixed URI path extraction examples.
- #38 Added more tests to ensure pipe path is trimmed from URI.
This release updates its dependencies to use psr/http-message >= 0.9.0 and
phly/http >= 0.11.0. The primary changes that affect Conduit regard changes to
Psr\Http\Message\ServerRequestInterface
, which required method name and
signature changes in Phly\Conduit\Http\Request
.
Phly\Conduit\Http\Request::getParsedBody()
(replacesgetBodyParams()
).Phly\Conduit\Http\Request::withParsedBody()
(replaceswithBodyParams()
).
- Nothing.
Phly\Conduit\Http\Request::getBodyParams()
(replaced bygetParsedBody()
).Phly\Conduit\Http\Request::withBodyParams()
(replaced bywithParsedBody()
).
This release updates its dependencies to use psr/http-message >= 0.8.0 and
phly/http >= 0.10.0. The primary changes that affect Conduit regard changes to
Psr\Http\Message\RequestInterface
and the renaming of
Psr\Http\Message\UriTargetInterface
to Psr\Http\Message\UriInterface
, which
required changes in Phly\Conduit\Http\Request
.
Phly\Conduit\Http\Request::getRequestTarget()
, to fetch the request-target.Phly\Conduit\Http\Request::withRequestTarget()
, to allow creating a new instance with the specified request-target, allowing developers to set a non-origin-form request-target.
- Nothing.
- Nothing.
Phly\Conduit\Http\Request
now typehints againstPsr\Http\Message\UriInterface
for methods dealing with the URI.
This release makes one backwards-incompatible change: Due to the changes in
0.11.0, the $done
callable to a Next
instance MUST use the same
signature as Next::__invoke()
. This is due to the fact that a MiddlewarePipe
instance will pass a Next
instance to its children; if the signature is not
the same, the arguments are not provided in the correct order when returning to
the parent.
The BC break that occurs is in the signature of FinalHandler::_invoke()
, which
has been changed to mimic that of Next::__invoke()
.
- Updated to phly/http 0.9.0.
- Nothing.
- Nothing.
Next::__invoke()
now calls its$done
instance using the same arguments and same order in which it received its own.FinalHandler::__invoke()
now implements the same signature asNext::__invoke()
.
This release makes several backwards-incompatible changes.
Middleware
was renamed toMiddlewarePipe
. Otherwise, the behavior is exactly the same.Next
was rewritten to have a consistent invocable signature:function (ServerRequestInterface $request, ResponseInterface $response, $err = null)
This change simplifies the logic, removes bugs caused by edge cases, and leads to consistent usage that's easier to remember.
Phly\Conduit\MiddlewareInterface
, which provides an interface to typehint against for middleware. It's usage is not enforced (only a callable is required), butPhly\Conduit\Dispatch
contains optimizations based on the interface.Phly\Conduit\ErrorMiddlewareInterface
, which provides an interface to typehint against for error-handling middleware. It's usage is not enforced (only a callable with arity 4 is required), butPhly\Conduit\Dispatch
contains optimizations based on the interface.Phly\Conduit\MiddlewarePipe
(replaces byPhly\Conduit\Middleware
).
- Nothing.
Phly\Conduit\Next::__construct
no longer accepts the$request
or$response
arguments, as the values are no longer stored internally.Phly\Conduit\Middleware
(replaced byPhly\Conduit\MiddlewarePipe
).
MiddlewarePipe
was updated to use anSplQueue
instance internally for modeling the middleware pipeline.- Properly fixes problems in
Next
reported in #25, #26, #27, and #28, which all revolve around resetting the path when trailing slashes are or are not present.
- Nothing.
- Nothing.
- Nothing.
- The logic in
Next
was updated to ensure that if a trailing slash was present in the path, but not the route, resetting the request URI path retains it.
- Nothing.
- Nothing.
- Nothing.
- The logic in
Middleware
was changed to store the route as provided, without stripping the trailing slash. This allows matching with or without it. - The logic in
Next
was updated to ensure that if a trailing slash was present in the route, resetting the request URI path retains it; alternately, if none was present, it is omitted.
FinalHandler::__invoke
's signature was modified to require the error argument, as well as a request and response instance. It now also returns a response.Next::__invoke
's signature was modified to remove the typehint from the second argument, and to add a third argument, typehinted againstPsr\Http\Message\ResponseInterface
. This change allows passing both an updated request and response in error conditions. It also now passes all three arguments to the final handler.
- Nothing.
FinalHandler::__construct
removes the arguments representing the request and response instances.
- The changes listed in "Added" and "Removed" fix a condition whereby error handlers were not getting updated response instances, causing those that introspect the response to fail. With the changes, behavior returns to normal.
- Nothing.
- Nothing.
- Nothing.
- Use phly/http >= 0.8.2, as that is the first version that properly supports PHP 5.4, allowing Conduit to work under PHP 5.4.
- Updated return value annotation in
Middleware::pipe
to read solelyself
.
This version syncs Conduit with psr/http-message 0.6.0 and phly/http 0.8.1. The primary changes are:
Phly\Conduit\Http\Request
now implementsPsr\Http\Message\ServerRequestInterface
, and extendsPhly\Http\ServerRequest
, which means it is also now immutable. It no longer provides property access to attributes, and also now stores the original request, not the original URI, as a property, providing an accessor to it.Phly\Conduit\Http\Response
now implementsPsr\Http\Message\ResponseInterface
, which means it is now immutable.- The logic in
Phly\Conduit\Next
's__invoke()
was largely rewritten due to the fact that the request/response pair are now immutable, and the fact that the URI is now an object (simplifying many operations). - The logic in
Phly\Conduit\Middleware
,Phly\Conduit\Dispatch
, andPhly\Conduit\FinalHandler
also needed slight updates to work with the request/response changes.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
Phly\Conduit\Http\Request::$params
, as it is no longer used.
README.md
was updated to referenceOutgoingResponseInterface
instead ofResponseInterface
.
- Nothing.
- Nothing.
- Nothing.
Phly\Conduit\Http\Request
now proxies the property overloading methods to the underlying request's "attributes" methods.
Updates to psr/http-message 0.5.1 and phly/http 0.7.0. These libraries had several BC incompatible changes, requiring BC-breaking changes in Conduit.
Phly\Conduit\Http\Request::getAttribute($attribute, $default = null)
Phly\Conduit\Http\Request::setAttribute($attribute, $value)
Phly\Conduit\Http\Response::setStatus($code, $reasonPhrase = null)
(replacessetStatusCode()
andsetReasonPhrase()
)
- Nothing.
- Removed all setters except for
setUrl()
inPhly\Conduit\Http\Request
. - Removed
setStatusCode()
andsetReasonPhrase()
fromPhly\Conduit\Http\Response
(replaced withsetStatus()
).
Phly\Conduit\Middleware
now typehints onPsr\Http\Message\OutgoingResponseInterface
instead ofPsr\Http\Message\ResponseInterface
(which was removed).
Updates to psr/http-message 0.4.0 and phly/http 0.6.0. These libraries had several BC incompatible changes, requiring BC-breaking changes in Conduit.
- Specifying
array
as the only accepted input type and return type for allIncomingRequestInterface
-specific methods. - Added
(set|get)Attributes()
to the request decorator (replaces(set|get)PathParams()
.
- Nothing.
- Removed of
setHeaders()
andaddHeaders()
in both the request and response decorators. - Removed
(set|get)PathParams()
in the request decorator (replaced by(set|get)Attributes()
.
- Updated
composer.json
to pushPhlyTest\\Conduit\\
namespace autoloading to theautoload-dev
section (meaning no entry will be added when generating production autoloader rules).
- Nothing.
- Nothing.
- Nothing.
composer.json
now specifies~0.5.0@dev
for thephly/http
dependency.
Updated to psr/http-message 0.3.0 and phly/http 0.5.0. The changes required to do so are not backwards incompatible. In particular, all typehints against Psr\Http\Message\RequestInterface
have been changed to Psr\Http\Message\IncomingRequestInterface
, as the middleware in Conduit is expected to be server-side, and accept incoming requests.
Phly\Conduit\Http\Request
now implementsPsr\Http\Message\IncomingRequestInterface
, and defines the following new methods:getCookieParams()
setCookieParams($cookies)
getQueryParams()
getFileParams()
getBodyParams()
setBodyParams($values)
getPathParams()
setPathParams(array $values)
Phly\Conduit\Http\Request
adds asetProtocolVersion()
method, as it is now defined inPsr\Http\Message\MessageInterface
.Phly\Conduit\Http\Response
adds asetProtocolVersion()
method, as it is now defined inPsr\Http\Message\MessageInterface
.
- Nothing.
- Nothing.
Phly\Http\Middleware::__invoke
now typehints the$request
argument againstPsr\Http\Message\IncomingRequestInterface
.
- Nothing.
- Nothing.
- Nothing.
- Updated README:
- Removes references to
Phly\Http\ResponseInterface
(no longer exists) - Updates the version for
psr/http-message
to~0.2.0@dev
- Adds descriptions for
Phly\Conduit\Http\Request
andPhly\Conduit\Http\Response
.
- Removes references to
- Nothing.
- Nothing.
- Nothing.
- Updated to psr/http-message 0.2.0 and phly/http 0.4.0:
- StreamInterface becomes StreamableInterface
- Stream interface changes:
- adds attach() and getMetadata() methods
- removes the $maxLength argument from the getContents() method
- Nothing.
- Nothing.
- Nothing.
- Updated
FinalHandler
to report the exception message as part of the response payload.
- Nothing.
- Nothing.
- Nothing.
- #6 casts arrays assigned to request property values to
ArrayObject
to fix dereferencing issues.
- Nothing.
- Nothing.
- Nothing.
- Improved test coverage.
- Fixed
Phly\Conduit\Http\Request::getBody()
implementation; ensures it proxies to correct method.
- Nothing.
- Nothing.
- Nothing.
- Ensures
$originalUrl
is set from the composed request's URL at instantiation of the request decorator; this ensures the property is set from the outset.
- Adds
$originalUrl
to the request implementation; set first timesetUrl()
is called.
- Nothing.
- Nothing.
- Adds
$originalUrl
to the request implementation; set first timesetUrl()
is called. (This was present in the original phly/http implementation, but is removed as of 0.2.0 of that project.)
This release adds HTTP decorators for the request and response objects in order to ensure expected functionality is present regardless of the PSR implementation. This ensures greater compatibility with other implementations, while keeping the current implementation robust. It also fortunately poses no backwards compatibility issues.
Phly\Conduit\Http\Request
, a decorator forPsr\Http\Message\RequestInterface
, which adds the ability to set and retrieve arbitrary object properties.Phly\Conduit\Http\ResponseInterface
, which defines:write($data)
to proxy to the underlying stream'swrite()
method.end($data = null)
to optionally write to the underlying stream, and then mark the response as complete.isComplete()
to indicate whether or not the response is complete.
Phly\Conduit\Http\Response
, a decorator forPsr\Http\Message\ResponseInterface
which also implementsPhly\Conduit\Http\ResponseInterface
, and ensure that if the response is complete, it is immutable.
- Nothing.
- Nothing.
- Nothing.
This release separates the HTTP functionality into its own package, phly/http. As such, the subnamespaces Phly\Conduit\Http
and PhlyTest\Conduit\Http
were removed, as they became part of that package. Additionally, the following changes were made:
Middleware::handle()
was renamed toMiddleware::__invoke()
, to be compatible with thephly/http
server implementation.- All signatures that referred to the former Http subnamespace now refer to the
phly/http
namespace (Phly\Http
). - Examples were rewritten to show instantiating a
Phly\Http\Server
instead of aPhly\Conduit\Http\Server
.
- Nothing.
- Nothing.
-
Phly\Conduit\Http\*
were removed; this includes:AbstractMessage
Request
RequestFactory
Response
ResponseInterface
Stream
Uri
Server
Each of these are now part of the phly/http package; install that package to use them.
- Nothing.
Most importantly, this release changes the signature of Phly\Conduit\Http\Server::createServer()
. Previously, the signature was:
public static function createServer(
Phly\Conduit\Middleware $middleware,
Psr\Http\Message\RequestInterface $request = null,
Phly\Conduit\Http\ResponseInterface $response = null
);
It is now:
public static function createServer(
Phly\Conduit\Middleware $middleware,
array $server // usually $_SERVER
);
A new method, createServerFromRequest()
, has the original arguments, albeit with the request argument required:
public static function createServer(
Phly\Conduit\Middleware $middleware,
Psr\Http\Message\RequestInterface $request,
Phly\Conduit\Http\ResponseInterface $response = null
);
This method will create a response for you if none is provided.
Finally, the constructor is now public, allowing you to instantiate directly if you have each of the middleware, request, and response objects prepared:
public function __construct(
Phly\Conduit\Middleware $middleware,
Psr\Http\Message\RequestInterface $request,
Phly\Conduit\Http\ResponseInterface $response
);
-
Phly\Conduit\Http\RequestFactory
, a static class for populating aPsr\Http\Message\RequestInterface
instance based on$_SERVER
. The primary entry method isfromServer()
:// Create a new request, based on $_SERVER: $request = Phly\Conduit\Http\RequestFactory::fromServer($_SERVER); // Populate an existing request, based on $_SERVER: $request = Phly\Conduit\Http\RequestFactory::fromServer($_SERVER, $request);
-
Phly\Conduit\Http\Server::__construct()
; see above. -
Phly\Conduit\Http\Server::createServerFromRequest()
; see above.
- Nothing.
Phly\Conduit\Http\Server
removes all methods for marshaling a request object, and instead delegates toPhly\Conduit\Http\RequestFactory::fromServer()
when thecreateServer()
method is invoked.Phly\Conduit\Next
no longer keeps track of a "slash added" status, as thePhly\Conduit\Http\Uri
implementation obviates it.
- Used scrutinizer to refactor almost the entire code base to make it less complex, more stable, and easier to maintain. In many cases, extract method refactors were applied, in ways that keep the public API unchanged, but which remove complexity internally.
Phly\Conduit\Http\Server
now keeps track of the initial buffer level, and does not rewind beyond it when invokingsend()
.Phly\Conduit\Http\Request::setUrl()
now throws an exception if neither a string or aPhly\Conduit\Http\Uri
instance is provided.Phly\Conduit\Http\Stream
now throws exceptions at instantiation if the provided stream is not a resource or a string capable of being a resource.Phly\Conduit\Http\Stream
now detaches the resource whenclose()
is called.Phly\Conduit\Http\Stream
now returns false if the stream has been detached when callingisSeekable()
.Phly\Conduit\Http\Stream
now casts the return value offseek()
to the appropriate boolean duringseek()
.
Initial release.