Skip to content

Releases: effectra/http-message

v2.0.0

Choose a tag to compare

@BMTmohammedtaha BMTmohammedtaha released this 26 Jul 21:13

Added

  • PHP 8.1 readonly properties on UploadedFile ($file, $size, $error, $name, $type) and Stream::$buffer
  • final keyword on Message, Response, ServerRequest, Stream, UploadedFile, Uri
  • #[Immutable] and #[Deprecated] PHP 8 attributes in Effectra\Http\Message\Attribute namespace
  • Response::withJson() — instance method for JSON responses (accepts $data, $status, $flags)
  • Response::json() — static factory for JSON responses (accepts $data, $status, $headers, $flags)
  • Response::html() — static factory for HTML responses with Content-Type: text/html
  • Response::emptyResponse() — static factory for empty-body responses (defaults to 204)
  • ServerRequest::fromGlobals() — populates request from $_SERVER, $_GET, $_POST, $_COOKIE, $_FILES
  • ServerRequest::replaceHeader() — removes and re-adds header values in one call
  • Stream constructor now accepts file-path strings (opens via fopen if the file exists)
  • UploadedFile::getStream() now reads from the underlying file and returns a Stream with contents
  • Case-insensitive header storage: hasHeader(), getHeader(), withHeader(), withAddedHeader(), withoutHeader(), setHeader(), AddHeader() all normalize keys to lowercase
  • Complete $statusTexts map for all standard HTTP status codes (100–511)
  • 196+ Pest test suite covering all classes
  • PHPStan configuration (phpstan.neon, phpstan-baseline.neon) — level 6 clean
  • _ide_helper.php for enhanced IDE autocompletion

Fixed

  • MessageTrait::getHeader() now returns array instead of raw string value
  • MessageTrait::getHeaders() normalizes all values to arrays
  • MessageTrait::withProtocolVersion() now clones instead of mutating in place
  • Request::getRequestTarget() handles string-URI edge case
  • Request::setUri() uses mutable header manipulation instead of with* chain
  • Response default $reasonPhrase changed from 'OK' to '' — resolves from $statusTexts at runtime
  • Response::getReasonPhrase() prioritises custom phrase over static list
  • ServerRequest::getServerParams() returns dedicated $serverParams property (was incorrectly returning $attributes)

[0.1.0] - 2025-03-21

Added

  • PSR-7 ServerRequest, Request, Response, Message, Uri, Stream, UploadedFile classes
  • MessageTrait for shared message implementation
  • Basic request/response/URI/stream/uploaded-file functionality
  • Initial test suite
  • README with usage examples

v1.0.3

Choose a tag to compare

@BMTmohammedtaha BMTmohammedtaha released this 06 Jan 20:47
add setter for each  var in Message/Request/Response

v1.0.2

Choose a tag to compare

@BMTmohammedtaha BMTmohammedtaha released this 13 Oct 11:10
update getServerParams/getCookieParams/withCookieParams methods

v1.0.1

Choose a tag to compare

@BMTmohammedtaha BMTmohammedtaha released this 24 Jul 22:41
change uploadFile impl.

v1.0.0

Choose a tag to compare

@BMTmohammedtaha BMTmohammedtaha released this 19 Jun 15:23
change uploadFile impl.