By providing a Gitlab\HttpClient\Builder
to the Gitlab\Client
constructor, you can customize the HTTP client.
$plugin = new Http\Client\Common\Plugin\HeaderSetPlugin([
'User-Agent' => 'Foobar',
]);
$builder = new Gitlab\HttpClient\Builder();
$builder->addPlugin($plugin);
$client = new Gitlab\Client($builder);
Read more about HTTPlug plugins here.
As timeout configuration is not compatible with HTTP client abstraction, you have to create the Gitlab\Client
with
an explicit HTTP client implementation.
$httpClient = Http\Adapter\Guzzle6\Client::createWithConfig([
'timeout' => 1.0
]);
$client = Gitlab\Client::createWithHttpClient($httpClient);