MichaelHall/html-validator-plugin

此包已被弃用且不再维护。未建议替代包。

HTML验证的BlueMvc插件

v2.1.0 2019-01-30 18:45 UTC

This package is auto-updated.

Last update: 2021-08-30 18:18:05 UTC


README

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

BlueMvc PHP框架提供的HTML验证插件。

要求

  • PHP >= 7.1

使用Composer安装

$ composer require michaelhall/html-validator-plugin

基本用法

安装后,此插件将通过validator.w3.org API验证每个HTML输出,如果验证失败,则将结果替换为错误消息。

为相同内容缓存验证结果。

$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);

许可证

MIT