PHP HTTP utils library that supports PSR-7 and PSR-17 with basic helpers and common operations.
Using composer.
composer require francerz/http-utilsPreserve per instance, reference of PSR-17 Factories (psr/http-factory). Uses set and get methods to manage existing factory instances.
setRequestFactory(RequestFactoryInterface $requestFactory)setResponseFactory(ResponseFactoryInterface $responseFactory)setServerRequestFactory(ServerRequestFactoryInterface $serverRequestFactory)setStreamFactory(StreamFactoryInterface $streamFactory)setUploadedFileFactory(UploadedFileFactoryInterface $uploadedFileFactory)setUriFactory(UriFactoryInterface $uriFactory)
Getter Methods will throw a LogicException if not factory has been set
previously.
getRequestFactory() : RequestFactoryInterfacegetResponseFactory() : ResponseFactoryInterfacegetServerRequestFactory() : ServerRequestFactoryInterfacegetStreamFactory() : StreamFactoryInterfacegetUploadedFileFactory() : UploadedFileFactoryInterfacegetUriFactory() : UriFactoryInterface
The method setMatchingFactories($factoryObject) receives an object and
checks implementation of each Factory Interface. All matching interfaces
will be set.
This method is included on the constructor to quick factory setting.
Provides methods for common manipulation to UriInterface objects.
getCurrent(UriFactoryInterface $uriFactory) : UriInterface
appendPath(UriInterface $uri, string $postpath) : UriInterfaceprependPath(UriInterface $uri, string $prepath) : UriInterface
withQueryParams(UriInterface $uri, string $key, $value) : UriInterfacewithQueryParams(UriInterface $uri, array $params, $replace = true) : UriInterfacewithoutQueryParam(UriInterface $uri, string $key, &$value = null) : UriInterfacegetQueryParams(UriInterface $uri) : arraygetQueryParam(UriInterface $uri, string $key) : ?string
withFragmentParam(UriInterface $uri, string $key, $value) : UriInterfacewithFragmentParams(UriInterface $uri, array $params, $replace = true) : UriInterfacewithoutFragmentParam(UriInterface $uri, string $key, &$value = null) : UriInterfacegetFragmentParams(UriInterface $uri) : arraygetFragmentParam(UriInterface $uri, string $key) : ?string
Provides methods for common manipulation to MessageInterface objects.
setHttpFactoryManager(HttpFactoryManager $factories)setAuthenticationSchemes(array $authenticationSchemeClasses)
getCurrentRequest() : RequestInterface
getAuthorizationHeader(MessageInterface $message) : ?AbstractAuthorizationHeader
getContent(MessageInterface $message)withContent(MessageInterface $message, string $mediaType, $content) : MessageInterface