knplabs/knp-markup-validator-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

knplabs/knp-markup-validator-bundle

Composer 安装命令:

composer require knplabs/knp-markup-validator-bundle

包简介

Provide markup validation for your Symfony2 based projects.

README 文档

README

Bundle that provides markup validation functionality to your Symfony2 based projects.

This bundle is in early development state, so any contribution is welcome! ;)

Installation

If you use a deps file, add:

[KnpMarkupValidatorBundle]
    git=http://github.com/KnpLabs/KnpMarkupValidatorBundle.git
    target=/bundles/Knp/Bundle/MarkupValidatorBundle

Or if you want to clone the repo:

git clone git://github.com/KnpLabs/KnpMarkupValidatorBundle.git vendor/bundles/Knp/Bundle/MarkupValidatorBundle

Add the namespace to your autoloader

<?php
// File: app/autoload.php
$loader->registerNamespaces(array(
    'Knp\\Bundle'      => __DIR__.'/../vendor/bundles',
    // ...
));

Add MarkupValidatorBundle to your application kernel

<?php
    // File: app/AppKernel.php
    public function registerBundles()
    {
        return array(
            // ...
            new Knp\Bundle\MarkupValidatorBundle\KnpMarkupValidatorBundle(),
            // ...
        );
    }

Define validators

The first step, after the bundle is installed in your project, is to define validators in your application configuration:

# app/config/config.yml
knp_markup_validator:
    default_validator:  default
    validators:
        default:
            processor:  tidy

It tells to the markup validator extension to create a validator service named markup_validator.default_validator using the tidy processor.

The default_validator tells the extension to create the markup_validator service which is an alias for the markup_validator.default_validator one.

You can define as many validators as you want.

Processors

Processors are used by the validator to validate the markup. They are responsible to return an array of warning and error messages.

The bundle provides two processors:

  • w3c which uses the validator.w3.org's api
  • tidy which uses the tidy binary

If you want to define your own validator, you simply need to create a service implementing the Knp\Bundle\MarkupValidatorBundle\Validation\ProcessorInterface with the markup_validator.processor tag and its name as alias tag attribute. The extension will create a service for each validator named as follow: markup_validator.{{ alias }}_processor.

统计信息

  • 总下载量: 48
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 34
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2012-03-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固