Skip to content
Psr http-message server-side message, response and stream implementation
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
src
test
README.md
autoload.php
composer.json
phpunit.xml

README.md

The Kigkonsult\Http\Message package provide PSR server-side

Message class

Stream class

Response class

Message class
Stream class
  • implements Psr\Http\Message\StreamInterface
  • constructor args: content, streamWrapper/resource, mode
  • with a (static) factory methods
    • factoryFromString( content [, streamWrapper [, mode ]] )
    • factoryFromResource( resource )
Response class

The Response class has an added property:

  • rawBody
    • response body (type mixed) before serialization/encoding

in parallel with

  • (Psr\Http\Message\)ServerRequest::parsedBody
  • (Psr\Http\Message\)ServerRequest::body

with corresponding methods:

  • getRawBody()
    • Return rawBody
  • isRawBodyEmpty()
    • Return bool true on empty rawBody
  • withRawBody()
    • Return new instance with rawBody

and two rawBody/body methods

  • getResponseBody()
    • Return rawBody if not empty else body
  • isBodyEmpty()
    • Return bool true if (serialized/encoded) body is empty

Two statusCode methods are added:

  • assertStatusCode()
    • (static) validates statusCode, throws InvalidArgumentException on error
  • isBodyLessResponse()
    • Return bool true on statusCode 1xx, 204 or 304
Installation

Composer, from the Command Line:

composer require kigkonsult/http-master:dev-master

Composer, in your composer.json:

{
    "require": {
        "kigkonsult/http-master": "dev-master"
    }
}

Composer, acquire access

<?php
use Kigkonsult\Http\Message\Stream;
use Kigkonsult\Http\Message\Message;
use Kigkonsult\Http\Message\Response;
...
include 'vendor/autoload.php';

Otherwise , download and acquire..

<?php
use Kigkonsult\Http\Message\Stream;
use Kigkonsult\Http\Message\Message;
use Kigkonsult\Http\Message\Response;
...
include 'pathToSource/http-master/autoload.php';
License

This project is licensed under the LGPLv3 License

You can’t perform that action at this time.