2017 © Pedro Peláez
 

library amp-update-cache

PHP Class to clear Google AMP Cache

image

ennexa/amp-update-cache

PHP Class to clear Google AMP Cache

  • Wednesday, April 25, 2018
  • by ennexa
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 33 % Grown

The README.md

AMP Cache Update

A simple PHP Class to update Google AMP Cache, (*1)

Installation

composer require ennexa/amp-update-cache:dev-master

Usage

To purge the cache for https://www.prokerala.com/health/?amp=1, (*2)

$var = new Ennexa\AmpCache\Update(PATH_TO_YOUR_PRIVATE_KEY); // Make sure your private key is outside document root

$status = $var->purge('https://www.prokerala.com/health/?amp=1');

The script will purge the cache url from all the caches listed in AMP Project's official caches list., (*3)

If you want to purge only Google's AMP cache, you can filter the list as below, (*4)

$updater = new Ennexa\AmpCache\Update(PATH_TO_YOUR_PRIVATE_KEY);
$updater->setCache(array_filter($updater->getCache(), function($cache) {
    return 'google' === $cache->id;
}));
$status = $updater->purge('https://www.prokerala.com/health/?amp=1');

The Versions

25/04 2018

dev-master

9999999-dev

PHP Class to clear Google AMP Cache

  Sources   Download

CC0-1.0

The Requires

 

The Development Requires

by Joyce Babu

cache google amp