This component is for any interaction with/from Http
common psr interface implementation.
common psr interface implementation.
..description missing
..description missing
implementations are really close to the common psr interfaces.
the differences are explained.
- public function withContentType(string $contentType)
- public function withContent(string $contentType, $body)
- public function getPathParam(string $routeUri, string $argumentName)
- public function getQueryParam(string $argumentName)
- public function withQueryParams(array $query)
request->uri->query will be also updated - public function withUploadedFiles(array $uploadFiles)
- public function withUploadedFile(string $formDataName, UploadedFileInterface $uploadedFile)
HttpRequestFactory covers some HttpRequest methods.
trait for common methods used in HttpRequest and HttpServerRequest.
HttpRequestMiddleware provides a middleware implementation.
request->uri->query will be also updated
validate Content-Type against ->body
..description missing
all implementations are really close to psr interfaces. only the differences explained.
HttpResponse implements the common psr interface.
HttpResponseFactory implements the psr interface and
HttpStream implements the psr interface and
- __constructor
is public and the class can be used directly
rewindAfterReading set stream->seek(0) to reuse the content
set mime_type. StreamFactory->createStreamFromFile will do this automatically
set fileName. StreamFactory->createStreamFromFile will do this automatically
HttpStreamFactory create the HttpStream directly without using any static functions. That allows us to inject the factory.
set, in case of a touchable file, mimeType and fileName to the HttpStream Object (IHttpStream).
- private function setStreamOrFile($streamOrFile)
streamOrFile
. is a touchable file
. or an instanceof IHttpStream
ClientMediaType and ClientFilename are set, if present.
composer require terrazza/component-http
- >= 7.4
- ext-curl
- ext-json
- ext-fileinfo