PHP code example of amphp / http-client-cache

1. Go to this page and download the library: Download amphp/http-client-cache library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

amphp / http-client-cache example snippets


use Amp\Cache\FileCache;
use Amp\Http\Client\HttpClientBuilder;
use Amp\Http\Client\Cache\SingleUserCache;
use Amp\Sync\LocalKeyedMutex;

$cache = new FileCache(__DIR__, new LocalKeyedMutex);

$client = (new HttpClientBuilder)
    ->intercept(new SingleUserCache($cache, $logger))
    ->build();