You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a2a74e5
Browse filesBrowse the repository at this point in the historyBrowse files
See [Response/Definitions](src/Response/Definitions) for more details about code
111
111
112
+
### Using your own HTTP client and cache
113
+
114
+
By default, requests are made with `file_get_contents()` and the IANA bootstrap files are cached in the system temporary directory.
115
+
116
+
The client optionally accepts a [PSR-18](https://www.php-fig.org/psr/psr-18/) HTTP client, a [PSR-17](https://www.php-fig.org/psr/psr-17/) request factory and a [PSR-16](https://www.php-fig.org/psr/psr-16/) cache. The HTTP client is used for both the bootstrap files and the RDAP queries, so timeouts, proxies, retries and logging follow your application's configuration. The cache stores the bootstrap files for `AbstractRdapService::cacheExpirations()` seconds.
117
+
118
+
```php
119
+
use ArrayAccess\RdapClient\Client;
120
+
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
121
+
use Symfony\Component\Cache\Psr16Cache;
122
+
use Symfony\Component\HttpClient\HttpClient;
123
+
use Symfony\Component\HttpClient\Psr18Client;
124
+
125
+
// Psr18Client is also a request factory, so the second argument can be omitted
126
+
$httpClient = new Psr18Client(HttpClient::create(['timeout' => 5]));
127
+
$cache = new Psr16Cache(new FilesystemAdapter());
128
+
$client = new Client($httpClient, null, $cache);
129
+
130
+
// any PSR-18 client works, e.g. Guzzle with a PSR-17 factory
131
+
$client = new Client(new \GuzzleHttp\Client(['timeout' => 5]), new \GuzzleHttp\Psr7\HttpFactory());
0 commit comments