michaelhall/html-validator-plugin

v2.0.0 2018-05-14 19:46 UTC

README

Build Status codecov.io Maintainability StyleCI License Latest Stable Version Total Downloads

HTML validator plugin for the BlueMvc PHP framework.

Requirements

  • PHP >= 7.1

Install with Composer

$ composer require michaelhall/html-validator-plugin

Basic usage

Once installed, this plugin validates every HTML output via the validator.w3.org API and replaces the result with an error message if validation failed.

Validation results are cached for identical content.

$htmlValidatorPlugin = new \MichaelHall\HtmlValidatorPlugin\HtmlValidatorPlugin();

// Do not validate anything under /ajax/
$htmlValidatorPlugin->addIgnorePath('/ajax/');

// ...or the path /foo/bar
$htmlValidatorPlugin->addIgnorePath('/foo/bar');

// By default, the plugin only runs in debug mode.
// To enable in release mode. (Not recommended) 
$htmlValidatorPlugin->enableInReleaseMode();

// Add to application.
$application->addPlugin($htmlValidatorPlugin);

License

MIT