guzzlehttp/psr7
Full PSR-7 message implementation with rich stream support: multiple stream types and decorators (append, buffer, caching, etc.), plus helpers like query-string parsing. Installed via Composer and maintained with v2 for PHP 7.2.5+.
Utils::redactUriForMessage() and Utils::redactUriStringForMessage() for URI diagnostics./ instead of throwing/. prefix for authority-less // paths to percent-encoding normalizations as wellfile host strands a // path, prefixing it with /.DiagnosticValue::escape() to escape controls and malformed UTF-8 in diagnosticsGuzzleHttp\Psr7\Exception\TimeoutException for timed-out stream operationsGuzzleHttp\Psr7\Utils::redactUserInfoInString() to redact the userinfo of a raw URI string within textGuzzleHttp\Psr7\Rfc3986 to public API with isValid*() predicates and canonicalizeIpv6()GuzzleHttp\Psr7\UriNormalizer::CANONICALIZE_IPV6_HOST to PRESERVING_NORMALIZATIONSpsr/http-message:^2.0 and add native parameter and return typespsr/http-factory:^1.1ServerRequest::fromGlobals() still uppercasestmp_name, size, or errorerror valuesUploadedFile::moveTo()read() lengths across all stream implementations+ flag anywhere in a mode for Stream::isReadable()/isWritable()PumpStream source callablesPumpStream close and detachMessage::bodySummary()null for the Message::bodySummary() truncation length to use the defaultLimitStream offset/limit and track non-seekable offset by bytes skippedFnStream close and detach terminal, calling close callbacks at most onceFnStream close callbacks during destructor cleanupCachingStream::close() idempotent, preserving remote cleanup after detachCachingStream cursor when a SEEK_END target on an unknown-size stream is rejectedUri::getPath() and origin-form request targetsfile URIs with rootless paths without the // separatorfile URIs with empty paths as file: instead of the unparseable file://// paths with /.UriResolver::relativize() when an empty-path target requires oneUriResolver::relativize() when it would inherit the base fragmentUriResolver::relativize() when an equal-path target's last path segment contains a colonUri::fromParts() ports instead of casting themws and wss schemesws and wss default ports in UriComparator::isCrossOrigin() port comparisonsUtils::redactUserInfo()$_SERVER by REQUEST_METHOD, using target authority before SERVER_PORTREQUEST_URI targets in ServerRequest::fromGlobals()HTTP_HOST and malformed SERVER_PORT in ServerRequest::getUriFromGlobals()REQUEST_METHOD and SERVER_PROTOCOL server values in ServerRequest::fromGlobals()Host and normalize leading-zero ports in Message::parseRequest()Host headers and validate present values for all request-target formsMessage::parseRequest()Host header in Request::withUri() when the URI changes or Host is emptyHost headers synthesized by Message::toString()Message::toString() from the request URIHost headers set by Utils::modifyRequest() URI changesOPTIONS * and CONNECT authority-form request targets in Message::parseRequest()Request::withRequestTarget()Utils::streamFor()Query::build()Query::build() and MultipartStream contentsUtils::streamFor()Utils::streamFor() now rejects non-string scalar bodiesUri::withQueryValues() now rejects non-string valuesUtils::modifyRequest() change valuesUtils::copyToStream() to throw when destination streams cannot make progressTimeoutException from Stream read/write and Utils copy/hash/readLine on stream timeoutsTimeoutException from AppendStream::read(), CachingStream::read(), and Utils::tryGetContents() on stream timeoutsTimeoutException from InflateStream when the decoded source stream times outInflateStream::close()Utils::copyToStream()OverflowException when stream byte counts or offsets exceed PHP_INT_MAXStreamWrapper runtime failures to PHP stream failure valuesContent-Length to multipart/form-data parts (RFC 7578 §4.8)Content-Disposition parameters and reject unsafe boundaries and part headersMultipartStream part header valuesMultipartStream boundary '0' instead of replacing it with a generated boundarywithHost(), including userinfo formsUri construction, fromParts(), and withHost()UriComparator::isCrossOrigin()CAPITALIZE_PERCENT_ENCODING and DECODE_UNRESERVED_CHARACTERS to userinfo and hostHeader::splitList()Header::parse()ralouphie/getallheaders dependencyHeader::normalize() methodUtils:: asciiToLower, asciiToUpper, asciiUcFirst, caselessEquals, caselessContains// as paths in Message::parseRequest()getHost() matches the URI authority (GHSA-c2w2-prh8-qm98)Query::build() that guzzlehttp/psr7 3.0 rejectsUtils::streamFor(); cast them to a string for 3.0Uri::withQueryValues() values; cast them to a string for 3.0Utils::modifyRequest() to reject conflicting URI and Host header changes in the same callHeader::parse() to split semicolon-separated parameters without repeated regular expression lookaheadsUriComparator::isCrossOrigin() so only HTTP and HTTPS missing ports receive implicit default portsUtils::modifyRequest() change values that guzzlehttp/psr7 3.0 will rejectUtils::copyToStream() to retry short destination writes instead of dropping the unwritten remainderHeader::parse() splitting of semicolon-separated parameters with escaped quotesUriNormalizer percent-encoding normalizations to URI fragmentsLimitStream::getSize() return 0 for slices past the underlying stream endAppendStream::read() return an empty string when no streams are attachedCachingStream::read() throw on an incomplete cache-target write instead of silently corrupting replaysCachingStream::seek() from looping indefinitely when the remote stream makes no progressServerRequest::fromGlobals() robust against unexpected HTTP header value types in $_SERVERUtils::modifyRequest() with numeric header namesCachingStream::detach() returning an incomplete resource before the decorated stream has been fully readMessage::bodySummary() returning null when truncating printable UTF-8 bodies inside a multibyte characterServerRequest::fromGlobals() against malformed $_SERVER valuesStreamWrapper::getResource() cannot create a resourceUtils::modifyRequest()UriResolver::resolve()Uri::__toString() side-effect-freeMultipartStream[@return](https://github.com/return) static to MessageTrait methods+ signs in Uri::withQueryValue() and Uri::withQueryValues() to prevent them being interpreted as spacesUtils::redactUserInfo() methodQuery::buildStreamWrapper::stream_stat() return false if inner stream's size is nullcall_user_func* with native callsapplication/octet-stream if we are unable to guess the content type for a multipart file upload.acc files to audio/aacpsr/http-message version constraint to ^1.1 || ^2.0ServerRequest::normalizeNestedFileSpecMessage::bodySummary when preg_match failsAllowDynamicProperties in LazyOpenStreamsha1(uniqid()) by bin2hex(random_bytes(20))Message::bodySummaryUriComparator::isCrossOrigin methodHeader::splitList methodUtils::tryGetContents methodStream::getContents methodMessage::parseRequestUri for numeric headersfread into runtime exceptionsuri metadatadata:// streamsHeader::normalize()Uri object from a malformed URI will no longer throw a generic
InvalidArgumentException, but rather a MalformedUriException, which inherits from the former
for backwards compatibility. Callers relying on the exception being thrown to detect invalid
URIs should catch the new exception.null in caching stream size if remote size is nullIdentical to the RC release.
url in stream_get_meta_dataGuzzleHttp\Psr7 namespace[@final](https://github.com/final) annotation to prepare for 2.0php://input and curl-ext is not installedUtils::tryFopen() on PHP 8Message:bodySummary()^3.0 of ralouphie/getallheaders dependency (#244)php://input in ServerRequest (#247)userInfo component of an URI (#253)get_message_body_summary function in order to get the message summary3gp and mkv mime typesAppendStream::detach to not close streamsInflateStream preserves isSeekable attribute of the underlying streamServerRequest::getUriFromGlobals to support URLs in query parametersSeveral other fixes and improvements.
Uri::resolve and Uri::removeDotSegments by removing
calls to trigger_error when deprecated methods are invoked.Uri::isDefaultPortUri::isAbsoluteUri::isNetworkPathReferenceUri::isAbsolutePathReferenceUri::isRelativePathReferenceUri::isSameDocumentReferenceUri::composeComponentsUriNormalizer::normalizeUriNormalizer::isEquivalentUriResolver::relativizeServerRequest::getUriFromGlobals returns a URI in absolute form.parse_response to parse a response without delimiting space and reason.(new Uri)->withPath('foo')->withHost('example.com') will throw an exception
because the path of a URI with an authority must start with a slash "/" or be empty(new Uri())->withScheme('http') will return 'http://localhost'Uri::resolve in favor of UriResolver::resolveUri::removeDotSegments in favor of UriResolver::removeDotSegmentsStream::read when length parameter <= 0.copy_to_stream reads bytes in chunks instead of maxLen into memory.ServerRequest::getUriFromGlobals when Host header contains port.file scheme and empty host.Uri::__toString for network path references, e.g. //example.org.'0' in a lot of places,
e.g. as a user info password.Uri::withAddedHeader to correctly merge headers with different case.Uri::withAddedHeader. Header values may
be surrounded by whitespace which should be ignored according to RFC 7230
Section 3.2.4. This does not apply to header names.Uri::withAddedHeader with an array of header values.Uri::resolve when base path has no slash and handling of fragment.Uri::with(out)QueryValue so one can pass the
key/value both in encoded as well as decoded form to those methods. This is
consistent with withPath, withQuery etc.ServerRequest::withoutAttribute when attribute value is null.GuzzleHttp\Psr7\CachingStream for seeking forward on remote
streams, which can sometimes return fewer bytes than requested with fread."0" is now properly added to a response.parse_request.multipart/form-data headers are now overridden case-insensitively.Initial release.
Currently unsupported:
Psr\Http\Message\ServerRequestInterfacePsr\Http\Message\UploadedFileInterfaceHow can I help you explore Laravel packages today?