2017 © Pedro Peláez
 

library http-modifier

Thruster HttpModifier Component (Modifies PSR-7 Request & Responses)

image

thruster/http-modifier

Thruster HttpModifier Component (Modifies PSR-7 Request & Responses)

  • Monday, January 25, 2016
  • by gcds
  • Repository
  • 1 Watchers
  • 1 Stars
  • 239 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 15 % Grown

The README.md

HttpModifier Component

[Latest Version] (https://github.com/ThrusterIO/http-modifier/releases) [Software License] (LICENSE) [Build Status] (https://travis-ci.org/ThrusterIO/http-modifier) [Code Coverage] (https://scrutinizer-ci.com/g/ThrusterIO/http-modifier) [Quality Score] (https://scrutinizer-ci.com/g/ThrusterIO/http-modifier) [Total Downloads] (https://packagist.org/packages/thruster/http-modifier), (*1)

[Email] (mailto:team@thruster.io), (*2)

The Thruster HttpModifier Component. Provides a backbone for modifying PSR-7 Request/Response for HTTP Clients/Servers and other utilities which uses PSR-7 standard., (*3)

Collection of Thruster Http Modifiers, (*4)

Install

Via Composer, (*5)

``` bash $ composer require thruster/http-modifier, (*6)


### For PHP < 7.0 For older PHP version than PHP7 there is branch **php5** ``` bash $ composer require thruster/http-modifier ">=1.0,<2.0"

Usage

There are four type of modifiers:, (*7)

  • ServerRequestModifierInterface
  • RequestModifierInterface
  • ResponseModifierInterface
  • MessageModifierInterface

Each of them has own Collection to group them and run modify on each of modifier., (*8)

Standalone modifier

$modifier = new class implements ResponseModifierInterface {
    public function modify(ResponseInterface $response) : ResponseInterface
    {
        return $response->withHeader('X-Powered-By', 'Thruster/1.0');
    }
}

$response = $modifier->modify($response);

Using collection

$collection = new ResponseModifierCollection();
$collection->add(new ServerTimeModifier());
$collection->add(new PoweredByModifier('Thruster/1.0'));

$response = $collection->modify($response);

Nesting collections

$collectionA = new ResponseModifierCollection();
$collectionA->add(new ServerTimeModifier());
$collectionA->add(new PoweredByModifier('Thruster/1.0'));

$collectionB = new ResponseModifierCollection();
$collectionB->add($collectionA);

$response = $collectionB->modify($response);

Testing

bash $ composer test, (*9)

Contributing

Please see CONTRIBUTING and CONDUCT for details., (*10)

License

Please see License File for more information., (*11)

The Versions

25/01 2016

dev-master

9999999-dev https://thruster.io

Thruster HttpModifier Component (Modifies PSR-7 Request & Responses)

  Sources   Download

MIT

The Requires

 

The Development Requires

psr-7 http psr7 request response modifier thruster

24/01 2016

2.0.0

2.0.0.0 https://thruster.io

Thruster HttpModifier Component (Modifies PSR-7 Request & Responses)

  Sources   Download

MIT

The Requires

 

The Development Requires

psr-7 http psr7 request response modifier thruster

24/01 2016

dev-php5

dev-php5 https://thruster.io

Thruster HttpModifier Component (Modifies PSR-7 Request & Responses)

  Sources   Download

MIT

The Requires

 

The Development Requires

psr-7 http psr7 request response modifier thruster

24/01 2016

1.0.0

1.0.0.0 https://thruster.io

Thruster HttpModifier Component (Modifies PSR-7 Request & Responses)

  Sources   Download

MIT

The Requires

 

The Development Requires

psr-7 http psr7 request response modifier thruster