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
Documentation navigation
- Server request from global environment
- HTML and JSON responses
-
- HTML response
-
- JSON response
- Streams
-
- File stream
-
- PHP input stream
-
- PHP memory stream
-
- PHP temporary stream
-
- Temporary file stream
- PSR-7 and PSR-17
- Exceptions
How to use
We highly recommend that you study PSR-7 and PSR-17 because only superficial examples will be presented below.
Server request from global environment
HTML and JSON responses
HTML response
JSON response
You can also specify encoding flags and maximum nesting depth like below:
Streams
File stream
PHP input stream
More details about the stream at the official page.
PHP memory stream
More details about the stream at the official page.
PHP temporary stream
More details about the stream at the official page.
You can also specify the memory limit, when the limit is reached, PHP will start using the temporary file instead of memory.
Please note that the default memory limit is 2MB.
Temporary file stream
More details about the temporary file behaviour at the official page.
The stream opens a unique temporary file in binary read/write (w+b) mode. The file will be automatically deleted when it is closed or the program terminates.
If you don't need the above behavior, you can use another temporary file stream:
PSR-7 and PSR-17
The following classes implement 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 implement 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
Exceptions
Any exceptions of this package can be caught through the 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