2017 © Pedro Peláez
 

symfony-bundle extra-validator-bundle

Symfony2 Validators for Spain Postcodes and Personal identifications

image

undanet/extra-validator-bundle

Symfony2 Validators for Spain Postcodes and Personal identifications

  • Monday, October 5, 2015
  • by rubenundanet
  • Repository
  • 4 Watchers
  • 0 Stars
  • 112 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 11 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

ExtraValidator bundle for Symfony2

This package contains a set of useful validators and asserts to use in your projects., (*1)

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, (*2)

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

... and in your AppKernel.php file:, (*3)

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

How to use ExtraValidator in your Forms/Entities

<?php
namespace Acme\AcmeDemoBundle\Entity;

use Undanet\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:, (*4)

<?php
namespace Acme\AcmeDemoBundle\Entity;

use Symfony\Component\Validator\Constraints as Assert;
use Undanet\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!, (*5)

Authors

  • javiacei
  • Moisés Maciá

The Versions

05/10 2015

dev-master

9999999-dev

Symfony2 Validators for Spain Postcodes and Personal identifications

  Sources   Download

The Requires

  • php >=5.3

 

05/10 2015

dev-NieValidator

dev-NieValidator

Symfony2 Validators for Spain Postcodes and Personal identifications

  Sources   Download

The Requires

  • php >=5.3

 

09/06 2015

dev-develop

dev-develop

Symfony2 Validators for Spain Postcodes and Personal identifications

  Sources   Download

The Requires

  • php >=5.3