https://github.com/ricardofiorani/php-cloudflare-amp-validator
A PHP wrapper for Cloudflare AMP validator PSR-18-ready
https://github.com/ricardofiorani/php-cloudflare-amp-validator
amp amp-html automated-testing ci cloudflare cloudflare-amp cloudflare-api php
Last synced: 6 months ago
JSON representation
A PHP wrapper for Cloudflare AMP validator PSR-18-ready
- Host: GitHub
- URL: https://github.com/ricardofiorani/php-cloudflare-amp-validator
- Owner: ricardofiorani
- License: mit
- Created: 2018-09-03T16:54:22.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-04-29T20:18:11.000Z (over 4 years ago)
- Last Synced: 2025-04-19T23:53:14.056Z (6 months ago)
- Topics: amp, amp-html, automated-testing, ci, cloudflare, cloudflare-amp, cloudflare-api, php
- Language: PHP
- Homepage:
- Size: 35.2 KB
- Stars: 5
- Watchers: 0
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# NOT WORKING ANYMORE / FEATURE DISABLED BY CLOUDFLARE
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
[](http://travis-ci.org/ricardofiorani/php-cloudflare-amp-validator)
[](https://php.net/)
[](https://packagist.org/packages/ricardofiorani/php-cloudflare-amp-validator)
[](https://packagist.org/packages/ricardofiorani/php-cloudflare-amp-validator)
[](https://github.com/php-fig-rectified/fig-rectified-standards)
[](https://scrutinizer-ci.com/g/ricardofiorani/php-cloudflare-amp-validator/?branch=master)
[](https://scrutinizer-ci.com/g/ricardofiorani/php-cloudflare-amp-validator/?branch=master)PHP Cloudflare AMP Validator is a PHP Library that wraps the [Cloudflare AMP validation API](https://blog.cloudflare.com/amp-validator-api/).
## Requirements
- PHP >=7.1
- A PSR-18 HttpClient## Install
Via Composer
``` bash
$ composer require ricardofiorani/php-cloudflare-amp-validator
```## Usage
``` php
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
``` bash
$ composer test
```## Credits
- [Ricardo Fiorani](https://github.com/ricardofiorani)
- [All Contributors](https://github.com/ricardofiorani/php-cloudflare-amp-validator/graphs/contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.