Site du proximo, utilisé pour gérer le stock.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cached_example.php 537B

12345678910111213
  1. use Symfony\Component\Cache\Adapter\FilesystemAdapter;
  2. use Symfony\Component\Cache\Psr16Cache;
  3. include '../../vendor/autoload.php';
  4. $logger = new \Monolog\Logger('test');
  5. $httpClient = new \GuzzleHttp\Client();
  6. // the PSR-6 cache object that you want to use (you might also use a PSR-16 Interface Object directly)
  7. $psr6Cache = new FilesystemAdapter();
  8. $psr16Cache = new Psr16Cache($psr6Cache);
  9. $api = new \OpenFoodFacts\Api('food', 'world', $logger, $httpClient, $psr16Cache);
  10. $product = $api->getProduct(rand(1, 50));