- Provides a simple http client interface
- Provides a simple request and response object
- Provides a header converter
- PHP 5.3+
Through Composer as saxulum/saxulum-http-client-interface.
{
"require": {
"saxulum/saxulum-http-client-interface": "~1.0",
"saxulum/saxulum-http-client-adapter": "~1.0"
}
}
Replace saxulum/saxulum-http-client-adapter-buzz
with the adapter you like to use.
{
"require": {
"saxulum/saxulum-http-client-interface": "~1.0",
"saxulum/saxulum-http-client-adapter-buzz": "~1.0"
}
}
$httpClient = new MyHttpClientImplementation;
$response = $httpClient->request(new Request(
'1.1',
Request::METHOD_GET,
'http://en.wikipedia.org',
array(
'Connection' => 'close',
)
));
To implement this interface, you need a existing http client and write an adapter for it or use an existing one.
<?php
namespace Saxulum\HttpClient;
interface HttpClientInterface
{
/**
* @param Request $request
* @return Response
*/
public function request(Request $request);
}
Add the following to your adapter composer.json
{
"provide": {
"saxulum/saxulum-http-client-adapter": "1.0"
}
}
- saxulum-http-client-adapter-buzz a kriswallsmith/buzz adapter
- saxulum-http-client-adapter-joomla a joomla/http adapter
- saxulum-http-client-adapter-guzzle a guzzle/guzzle adapter
- saxulum-http-client-adapter-vinelab a vinelab/http adapter
- saxulum-http-client-adapter-zend a zendframework/zend-http adapter