Skip to content

Commit 88734a3

Browse files
authored
Enhancement: Better readability of the docs (intercom#324)
1 parent 092d1e2 commit 88734a3

File tree

1 file changed

+36
-5
lines changed

1 file changed

+36
-5
lines changed

README.md

+36-5
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,52 @@ $client = new IntercomClient('<insert_token_here>');
3232
3333
For most use cases the code snippet above should suffice. However, if needed, you can customize the Intercom client as follows:
3434

35+
### Add custom headers
36+
3537
```php
3638
use Intercom\IntercomClient;
3739

38-
$client = new IntercomClient('<insert_token_here>', null, ['Custom-Header' => 'value']);
40+
$client = new IntercomClient(
41+
'<insert_token_here>',
42+
null,
43+
['Custom-Header' => 'value']
44+
);
45+
```
46+
47+
### Use a custom HTTP client
48+
49+
This client needs to implement `Psr\Http\Client\ClientInterface`
50+
51+
```php
52+
$client->setHttpClient($yourHttpClient);
53+
```
54+
55+
### Use a custom request factory
3956

40-
$client->setHttpClient($myCustomHttpClient); // $myCustomHttpClient implements Psr\Http\Client\ClientInterface
41-
$client->setRequestFactory($myCustomRequestFactory); // $myCustomRequestFactory implements Http\Message\RequestFactory
42-
$client->setUriFactory($myCustomUriFactory); // $myCustomUriFactory implements Http\Message\UriFactory
57+
This factory needs to implement `Http\Message\RequestFactory`
58+
59+
```php
60+
$client->setRequestFactory($yourRequestFactory);
61+
```
62+
63+
### Use a custom URI factory
64+
65+
This factory needs to implement `Http\Message\UriFactory`
66+
67+
```php
68+
$client->setUriFactory($yourUriFactory);
4369
```
70+
4471
## API Versions
4572

4673
This library is intended to work with any API Version. By default, the version that you have configured for your App in the [Developer Hub](https://developers.intercom.com/) will be used. However, you can overwrite that version for a single request or for all the requests using this library by including the `Intercom-Version` header when initializing the client as follows:
4774

4875
```php
49-
$client = new IntercomClient('<insert_token_here>', null, ['Intercom-Version' => '1.1']);
76+
$client = new IntercomClient(
77+
'<insert_token_here>',
78+
null,
79+
['Intercom-Version' => '1.1']
80+
);
5081
```
5182

5283
For more information about API Versioning, please check the [API Versioning Documentation](https://developers.intercom.com/building-apps/docs/api-versioning) and the [API changelog](https://developers.intercom.com/building-apps/docs/api-changelog).

0 commit comments

Comments
 (0)