Skip to content

Tags: eskono/http

Tags

0.7.1

Toggle 0.7.1's commit message
phly/http 0.7.1

Added
-----

- Nothing.

Deprecated
----------

- Nothing.

Removed
-------

- Nothing.

Fixed
-----

- README.md file now reflects actual API and presents client-side use cases.

0.7.0

Toggle 0.7.0's commit message
phly/http 0.7.0

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

- `Phly\Http\Request` and `Phly\Http\Response` were removed.
- `Phly\Http\MessageTrait` was altered to provide only accessors.
- `Phly\Http\IncomingResponse`, `Phly\Http\OutgoingResponse`, and `Phly\Http\OutgoingRequest` were added, providing segregation between client-side and server-side request/response pairs, and marking "incoming" variants as immutable. This necessitated adding `Phly\Http\RequestTrait`, `Phly\Http\ResponseTrait`, `Phly\Http\WritableMessageTrait`, and `Phly\Http\ImmutableHeadersTrait` to reduce code duplication and codify commonalities between different types.

Added
-----

- `Phly\Http\WritableMessageTrait` was added, and contains mutator (setter) methods for the properties defined in `Phly\Http\MessageTrait`. `setBody()` no longer allows setting a `null` value.
- `Phly\Http\ImmutableHeadersTrait` was 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\RequestTrait` was added, defining accessors (getters) for request instances: the request method and url.
- `Phly\Http\ResponseTrait` was 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 `$_SERVER` values. 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\OutgoingResponse` was added, as the complement to `Phly\Http\IncomingRequest`. It is fully mutable.
- `Phly\Http\OutgoingRequest` was added, for making client-side HTTP requests. It is fully mutable.
- `Phly\Http\IncomingResponse` was added, as a complement to `Phly\Http\OutgoingRequest`, and represents the response returned from such a request. It is immutable, and all values must be set via the constructor.

Deprecated
----------

- `Phly\Http\OutgoingRequest::setUrl()` no longer allows passing a `Phly\Http\Uri` (or an other object) instance; only strings are allowed.
- `Phly\Http\RequestTrait::getUrl()` no longer returns a `Phly\Http\Uri` instance, 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 throws
- `Phly\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).

Removed
-------

- All mutator methods (setters) were removed from `Phly\Http\MessageTrait`.
- `Phly\Http\Request` was removed.
- `Phly\Http\Response` was removed.
- `Phly\Http\IncomingRequest::setCookieParams()` was removed.
- `Phly\Http\IncomingRequest::setBodyParams()` was removed.

Fixed
-----

- CS issues.
- Removed obsolete tests.

0.6.0

Toggle 0.6.0's commit message
phly/http 0.6.0

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
^^^^^

- [phly#11](phly#11) Moved `PhlyTest` autoloader configuration to `autoload-dev` key, as it is needed for development purposes only.

0.5.0

Toggle 0.5.0's commit message
phly/http 0.5.0

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()`

- `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`

- `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.

- `Phly\Http\RequestFactory` (it is now `Phly\Http\IncomingRequestFactory`)

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

0.4.2

Toggle 0.4.2's commit message
phly/http 0.4.2

- [phly#10](phly#10) 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.

0.4.1

Toggle 0.4.1's commit message
phly/http 0.4.1

- [phly#8](phly#8) Update README.md to remove references to methods and interfaces that have been removed.
- Updated README.md to reference `~0.2.0@dev` as the psr/http-message version when installing via Composer.

0.4.0

Toggle 0.4.0's commit message
phly/http 0.4.0

- 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

0.3.3

Toggle 0.3.3's commit message
phly/http 0.3.3

- 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.

0.3.2

Toggle 0.3.2's commit message
phly/http 0.3.2

- [phly#5](phly#5) `Phly\Http\Server::sendHeaders` now _always_ sends multiple header lines if a header has multiple values.

0.3.1

Toggle 0.3.1's commit message
phly/http 0.3.1

- [phly#4](phly#4) `Phly\Http\Uri` now imports `InvalidArgumentException`.