aurora/http-codec

Decode raw request message and encode raw response message

dev-master / 1.0.x-dev 2018-02-03 07:25 UTC

This package is auto-updated.

Last update: 2024-12-19 11:09:53 UTC


README

Build Status Coverage Status Latest Stable Version Total Downloads Latest Unstable Version License Aurora Http

Decode raw request message and encode PRS-7 response object.

! The HTTP 2.0 part is under development and not yet supported.

Installation

It's recommended that you use Composer to install this library.

$ composer require aurora/http-codec

This will install the library and all required dependencies. The library requires PHP 7.0 or newer.

Usage

Decode raw Http message content to a request object:

$stream = new Aurora\Http\Decoder\Stream();
$stream = $stream->write($rawHttpMessage);

$decoder = new Aurora\Http\Decoder\Decoder();
$serverRequest = $decoder->decode($stream);

Encode a response object to stream:

$encoder = new Aurora\Http\Decoder\Encoder();
$stream = $encoder->encode($response);

License

The HTTP Codec is open-sourced software licensed under the MIT license.