ricardofiorani / php-cloudflare-amp-validator
A PHP wrapper for Cloudflare AMP validator
v1.0
2018-09-12 04:26 UTC
Requires
- php: >=7.1
- ext-json: *
- guzzlehttp/psr7: ^1.4
- psr/http-client: ^0.3.0
Requires (Dev)
- mockery/mockery: ^1.1
- phpunit/phpunit: ^7.3
- ricardofiorani/guzzle-psr18-adapter: ^1.0
- spryker/code-sniffer: ^0.12.3
Suggests
- ext-xml: Needed to support XML format in class Foo
- ricardofiorani/guzzle-psr18-adapter: Allows using Guzzle with this package
This package is auto-updated.
Last update: 2024-10-29 05:22:40 UTC
README
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
PHP Cloudflare AMP Validator is a PHP Library that wraps the Cloudflare AMP validation API.
Requirements
- PHP >=7.1
- A PSR-18 HttpClient
Install
Via Composer
$ composer require ricardofiorani/php-cloudflare-amp-validator
Usage
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());
Testing
$ composer test
Credits
License
The MIT License (MIT). Please see License File for more information.