php-extended/php-http-psr18-processor-bridge

This package is abandoned and no longer maintained. The author suggests using the psr/http-client package instead.

A library that bridges the psr-18 to the php-extended/php-http-processor-interface library

1.0.1 2019-01-14 19:57 UTC

README

A library that bridges the psr-18 to the php-extended/php-http-processor-interface library.

Installation

The installation of this library is made via composer. Download composer.phar from their website. Then add to your composer.json :

	"require": {
		...
		"php-extended/php-http-psr18-processor-bridge": "^1",
		...
	}

Then run php composer.phar update to install this library. The autoloading of all classes of this library is made through composer's autoloader.

Basic Usage

This library is a bridge between the psr-18 and the php-extended/php-http-processor-interface library that was created before the psr-18 was validated. This library provides two classes, one decorator that decorates an http processor to adapt it as a psr-18 http client, and one decorator that decorates a psr-18 http client as a processor interface.

They may be used the following way :

To bridge to a library that accepts only ProcessorInterfaces :


use PhpExtended\HttpProcessor\HttpClientToHttpProcessorAdapter;

// $client    instanceof \Psr\Http\Client\ClientInterface
// $processor instanceof \PhpExtended\HttpProcessor\ProcessorInterface
$processor = new HttpClientToHttpProcessorAdapter($client);

To bridge to a library that accepts only psr-18 ClientInterfaces :


use PhpExtended\HttpProcessor\HttpProcessorToHttpClientAdapter;

// $processor instanceof \PhpExtended\HttpProcessor\ProcessorInterface
// $client    instanceof \Psr\Http\Client\ClientInterface

$client = new HttpProcessorToHttpClientAdapter($processor);

License

MIT (See license file).