digitalbrands / amp-cache
A tool to update AMP cache
Installs: 12 556
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=5.6
- ext-openssl: *
- guzzlehttp/guzzle: ^6.3
Requires (Dev)
- phpunit/phpunit: ^5
This package is auto-updated.
Last update: 2024-10-29 05:10:50 UTC
README
Amp Update Cache library
Sometimes you need to tell Google to update cache of your AMP page. Read more: https://developers.google.com/amp/cache/update-cache
This library is an easy tool to do it. All you need is Private Api Key and url you'd like to update.
Usage
<?php $ampCache = \DigitalBrands\AmpCache\Cache::create('<YourPrivateApiKey>'); $ampCache->update('<YourAMPUrl>'); //or $ampCache->updateBatch(['<YourAMPUrl1>', '<YourAMPUrl2>'])
Configuration
$config=[ 'cache_list_url' => 'https://cdn.ampproject.org/caches.json', //A url servers list will be downloaded from. Default https://cdn.ampproject.org/caches.json 'servers' => ['cdn.ampproject.org'], //an array of cache servers. Then client will not download them from cache list url 'timeout' => 5, //A timeout for updating single url on particular cache server. Default 5. 'exception_on_group' => false, //If true then exception will be thrown only when all cache servers return bad response (not 200 code). If there is only one server in cache, then this option will be ignored ]; $ampCache = \DigitalBrands\AmpCache\Cache::create('<YourPrivateApiKey>', $config);