Skip to content

Releases: phly/http

phly/http 0.6.0

17 Oct 22:41
Compare
Choose a tag to compare

Updated component to psr/http-message 0.4.0. That release contains a number of backwards-incompatible changes.

Added

  • 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

Deprecated

  • 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

  • Removed ability to pass objects to MessageTrait::addHeader()/setHeader()
  • Removed setHeaders()/addHeaders() from MessageTrait
  • Modified IncomingRequest to s/PathParams/Attributes/g

Fixed

  • #11 Moved PhlyTest autoloader configuration to autoload-dev key, as it is needed for development purposes only.

phly/http 0.5.0

13 Oct 17:41
Compare
Choose a tag to compare

This release updates phly/http to make it compatible with psr/http-message 0.3.0.

This release has some backwards incompatible breaks, including:

  • Phly\Http\Request no longer accepts an HTTP protocol version as a constructor argument. Use setProtocolVersion() instead.
  • Phly\Http\Request now uses php://memory as the default body stream. (IncomingRequest uses php://input as the default stream.)
  • Phly\Http\RequestFactory has been renamed to Phly\Http\IncomingRequestFactory
    • It also now expects an IncomingRequestInterface if passed a request object to populate.
  • Phly\Http\Server::createServer() now expects 4 additional arguments:
    • $query, usually $_GET
    • $body, usually $_POST
    • $cookies, usually $_COOKIE
    • $files, usually $_FILES
  • Phly\Http\Server now composes a Psr\Http\Message\IncomingRequestInterface instance, not a Psr\Http\Message\RequestInterface instance. This has the implication that all handlers will now receive more specifically an IncomingRequest. The change affects each of the following method signatures:
    • __construct()
    • createServer()
    • createServerFromRequest()

Added

  • Phly\Http\MessageTrait::setProtocolVersion($version), per changes in PSR-7 (this is now defined in the MessageInterface).
  • Note in Phly\Http\Stream::read()'s @return annotation indicating that it can also return boolean false.
  • Phly\Http\IncomingRequest, which implements Psr\Http\Message\IncomingRequestInterface and 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 uses php://input as the default body stream.
  • Phly\Http\IncomingRequestFactory (which replaces Phly\Http\RequestFactory)
    • fromGlobals($server, $query, $body, $cookies, $files) factory method for creating an IncomingRequest instance 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

Deprecated

  • Phly\Http\Request no longer accepts an HTTP protocol version as a constructor argument. Use setProtocolVersion() instead.
  • Phly\Http\Server no longer works with standard Psr\Http\Message\RequestInterface implementations; it requires Psr\Http\Message\IncomingRequestInterface implementations.

Removed

  • Phly\Http\RequestFactory (it is now Phly\Http\IncomingRequestFactory)

Fixed

  • Phly\Http\Stream::read() now returns boolean false when the stream is not readable, or no resource is present.