As Cloudflare announced on https://blog.cloudflare.com/amp-validator-api/, their AMP validator is no longer available.
Well, it was nice while it lasted :)
PHP Cloudflare AMP Validator is a PHP Library that wraps the Cloudflare AMP validation API.
- PHP >=7.1
- A PSR-18 HttpClient
Via Composer
$ composer require ricardofiorani/php-cloudflare-amp-validator
use \RicardoFiorani\Validator\Validator;
$httpClient = new \Your\Psr18\HttpClient();
$requestFactory = new \Your\PSR-17\RequestFactoryInterface;
$validator = new Validator($httpClient, $requestFactory);
//or you can use the default request factory by ignoring the second parameter
$validator = new Validator($httpClient);
var_dump($validator->validateUrl('https://amp.mywebsite.com')->isValid());
$content = $yourHtmlRenderer->render();
var_dump($validator->validateContent($content)->isValid());
$ composer test
The MIT License (MIT). Please see License File for more information.