ideup/extra-validator-bundle 问题修复 & 功能扩展

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

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

ideup/extra-validator-bundle

Composer 安装命令:

composer require ideup/extra-validator-bundle

包简介

Symfony2 Validators for Spain Postcodes and Personal identifications

README 文档

README

This package contains a set of useful validators and asserts to use in your projects.

Included Asserts/Validators

  • DNI (DNI/NIF documents)
  • Phone (phone numbers, by regular expresions)
  • MobilePhone (mobile phone numbers)
  • PrefixedPhone (phone numbers with international prefix)

How to include ExtraValidator

In your composer.json

"require": {
  "ideup/extra-validator-bundle": "dev-master"
}

... and in your AppKernel.php file:

<?php
public function registerBundles()
{
    $bundles = array(
      ...
        new Ideup\ExtraValidatorBundle\IdeupExtraValidatorBundle(),
      );
}

How to use ExtraValidator in your Forms/Entities

<?php
namespace Acme\AcmeDemoBundle\Entity;

use Ideup\ExtraValidatorBundle\Validator as ExtraAssert;

class AcmeEntity {
  /**
   * @ExtraAssert\MobilePhone(message="Your mobile phone number is not valid")
   */
  protected $phone;

  ...
}

You can use both Assert and ExtraAssert validators in your entities/forms:

<?php
namespace Acme\AcmeDemoBundle\Entity;

use Symfony\Component\Validator\Constraints as Assert;
use Ideup\ExtraValidatorBundle\Validator as ExtraAssert;

class AcmeEntity {
  /**
   * @Assert\NotBlank(message="You have to input a phone number")
   * @ExtraAssert\MobilePhone(message="Your mobile phone number is not valid")
   */
  protected $phone;

  ...
}

ExtraAssert validators do not modify symfony's regular asserts, we just add a bunch of useful set of new validators to make our lives easy!

Authors

  • javiacei
  • Moisés Maciá

统计信息

  • 总下载量: 8.9k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 2
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-01-04