Helper trait for creating HTTP Rest clients
- PHP >= 5.3
The recommended way to install is through composer.
Just create a composer.json
file for your project:
{
"require": {
"ebidtech/http-client": "@stable"
}
}
Tip: browse ebidtech/http-client
page to choose a stable version to use, avoid the @stable
meta constraint.
And run these two commands to install it:
$ curl -sS https://getcomposer.org/installer | php
$ composer install
Now you can add the autoloader, and you will have access to the library:
<?php
require 'vendor/autoload.php';
<?php
namespace XXX;
use EBT\HttpClient\CreateTrait as HttpClientCreateTrait;
use Guzzle\Http\Client as GuzzleHttpClient;
class <HttpClient> {
use HttpClientCreateTrait;
/**
* @var GuzzleHttpClient
*/
private $client;
...
$this->client = $this->create($host, $userAgent, $config);
}
See CONTRIBUTING file.
- Ebidtech developer team, http-client
- All contributors
http-client library is released under the MIT License. See the bundled LICENSE file for details.