Download the PHP package sunrise/http-message without Composer
On this page you can find all versions of the php package sunrise/http-message. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package http-message
HTTP message wrapper for PHP 7.4+, based on RFC-7230, PSR-7, and PSR-17.
Installation
How to Use
We highly recommend studying PSR-7 and PSR-17, as only basic examples are provided below.
Server Request from Global Environment
Typed Messages
JSON Request
You can also specify encoding flags and the maximum nesting depth as shown below:
URL Encoded Request
You can also specify the encoding type as shown below:
JSON Response
You can also specify encoding flags and the maximum nesting depth as shown below:
HTML Response
Streams
File Stream
Input Stream
More details about this stream can be found on the official page.
Memory Stream
More details about this stream can be found on the official page.
Temporary Stream
More details about this stream can be found on the official page.
You can also specify a memory limit. When this limit is reached, PHP will switch to using a temporary file instead of memory.
Please note that the default memory limit is 2MB.
Temporary File Stream
For more details about the behavior of temporary files, visit the official page.
The stream opens a unique temporary file in binary read/write mode (w+b). The file will be automatically deleted when it is closed or when the program terminates.
If you don't require the behavior described above, you can use an alternative temporary file stream:
PSR-7 and PSR-17
The following classes are implementations PSR-7:
Sunrise\Http\Message\Request
Sunrise\Http\Message\Response
Sunrise\Http\Message\ServerRequest
Sunrise\Http\Message\Stream
Sunrise\Http\Message\UploadedFile
Sunrise\Http\Message\Uri
The following classes are implementations PSR-17:
Sunrise\Http\Message\RequestFactory
Sunrise\Http\Message\ResponseFactory
Sunrise\Http\Message\ServerRequestFactory
Sunrise\Http\Message\StreamFactory
Sunrise\Http\Message\UploadedFileFactory
Sunrise\Http\Message\UriFactory
Error Handling
Any exceptions thrown by this package can be caught through the following interface:
Test Run
Useful Links
All versions of http-message with dependencies
fig/http-message-util Version ^1.1
psr/http-factory Version ^1.0
psr/http-message Version ^1.0