diff --git a/docs/userguide/Clients.md b/docs/userguide/Clients.md index 70f1a8131..c7270d69e 100644 --- a/docs/userguide/Clients.md +++ b/docs/userguide/Clients.md @@ -116,6 +116,34 @@ To set default HTTP headers: $client->setDefaultOption('headers/X-Custom-Header', 'FooBar'); ``` +## User agents + +php-opencloud will send a default `User-Agent` header for every HTTP request, unless a custom value is provided by the end-user. The default header will be in this format: + +> User-Agent: OpenCloud/xxx cURL/yyy PHP/zzz + +where `xxx` is the current version of the SDK, `yyy` is the current version of cURL, and `zzz` is the current PHP version. To override this default, you must run: + +```php +$client->setUserAgent('MyCustomUserAgent'); +``` + +which will result in: + +> User-Agent: MyCustomUserAgent + +If you want to set a _prefix_ for the user agent, but retain the default `User-Agent` as a suffix, you must run: + +```php +$client->setUserAgent('MyPrefix', true); +``` + +which will result in: + +> User-Agent: MyPrefix OpenCloud/xxx cURL/yyy PHP/zzz + +where `$client` is an instance of `OpenCloud\OpenStack` or `OpenCloud\Rackspace`. + ## 5. Other functionality For a full list of functionality provided by Guzzle, please consult the [official documentation](http://docs.guzzlephp.org/en/latest/http-client/client.html).