PHP code example of nzm / amp-cache-url

1. Go to this page and download the library: Download nzm/amp-cache-url 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/ */

    

nzm / amp-cache-url example snippets


use Nzm\AmpCacheUrl\Generator;
use Nzm\AmpCacheUrl\ServingMode;

$generator = new Generator();
$domainSuffix = 'cdn.ampproject.org';
$url = 'https://example.com/amp/page.html';
$servingMode = ServingMode::Content;

$cacheUrl = $generator->Generate($domainSuffix, $url, $servingMode);

echo $cacheUrl;