PHP HTTP Tool kit that brings common functionality in a standard way, supporting PSR-7 and PSR-17.
Using composer.
composer require francerz/php-http-tools
Preserve 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() : RequestFactoryInterface
getResponseFactory() : ResponseFactoryInterface
getServerRequestFactory() : ServerRequestFactoryInterface
getStreamFactory() : StreamFactoryInterface
getUploadedFileFactory() : UploadedFileFactoryInterface
getUriFactory() : 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) : UriInterface
prependPath(UriInterface $uri, string $prepath) : UriInterface
withQueryParams(UriInterface $uri, string $key, $value) : UriInterface
withQueryParams(UriInterface $uri, array $params, $replace = true) : UriInterface
withoutQueryParam(UriInterface $uri, string $key, &$value = null) : UriInterface
getQueryParams(UriInterface $uri) : array
getQueryParam(UriInterface $uri, string $key) : ?string
withFragmentParam(UriInterface $uri, string $key, $value) : UriInterface
withFragmentParams(UriInterface $uri, array $params, $replace = true) : UriInterface
withoutFragmentParam(UriInterface $uri, string $key, &$value = null) : UriInterface
getFragmentParams(UriInterface $uri) : array
getFragmentParam(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