Developed with love by KnpLabs Hire us for your project!
36

ValidationBundle

by Respect

A Respect\Validation Bundle for Symfony

ValidationBundle

Build Status
Latest Stable Version
Total Downloads
Latest Unstable Version
License

A Respect\Validation Bundle for Symfony

Installation

Package is available on Packagist,
you can install it using Composer.

composer require respect/validation-bundle

Add the bundle to your AppKernel.php:

public function registerBundles()
{
    return array(
        // ...
        new Respect\ValidationBundle\RespectValidationBundle(),
        // ...
    );
}

Usage

Use as service respect.validator

//...
class AcmeController extends Controller
{
    public function indexAction()
    {
        $number = 123;
        $isValid = $this->get('respect.validator')->numeric()->validate($number);//true
//...

Use as alias

//...

use Respect\Validation\Validator as v;

class AcmeController extends Controller
{
    public function indexAction()
    {
        $validUsername = v::alnum()
            ->noWhitespace()
            ->length(1,15);

        $isValid = $validUsername->validate('alganet'); //true
        //...
Copyright (c) 2014, Alexandre Gomes Gaigalas, Claudson Oliveira and Daniel Ribeiro.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its contributors may be used to
endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
respect_validation:   []
  • Merge pull request #14 from GabrielJMJ/patch-1
    By henriquemoody, 4 years ago
  • Updating package for composer installation
    By , 4 years ago
  • Merge pull request #13 from henriquemoody/composer
    By henriquemoody, 4 years ago
  • Remove `target-dir` property from "composer.json"
    By henriquemoody, 4 years ago
  • Merge pull request #12 from henriquemoody/readme
    By henriquemoody, 4 years ago
  • Some improvements on "README.md" file
    By henriquemoody, 4 years ago
  • Merge pull request #11 from henriquemoody/upgrade
    By henriquemoody, 4 years ago
  • Upgrade "symfony/validator" version
    By henriquemoody, 4 years ago
  • Update Composer settings
    By henriquemoody, 4 years ago
  • Update Travis settings
    By henriquemoody, 4 years ago
  • Merge pull request #8 from royopa/develop
    By Alexandre Gomes Gaigalas, 4 years ago
  • fix some typos
    By royopa, 4 years ago
  • add more info to readme
    By royopa, 4 years ago
  • Add LICENSE (fixes #6)
    By cloudson, 5 years ago
  • Added packagist bling
    By nickl-, 5 years ago
  • Fixed next line braces
    By drgomesp, 6 years ago
  • Changed name of test suite on PHPUnit config file
    By drgomesp, 6 years ago
  • Changed phpunit script to run on travis ci with the --testdox option
    By drgomesp, 6 years ago
  • Added two more data sets for StringValidator test (array and stdClass)
    By drgomesp, 6 years ago
  • Changed AssertValidatorTest namespace and fixed PHP 5.4 error on tests (this fixes travis build)
    By drgomesp, 6 years ago
  • Deleted old files
    By drgomesp, 6 years ago
  • Changed class names
    By drgomesp, 6 years ago
  • Changed autoload.php file (also fixes travis build)
    By drgomesp, 6 years ago
  • Added missing dependency (this fixes travis build)
    By drgomesp, 6 years ago
  • Fixing travis config file format (was not being validated)
    By drgomesp, 6 years ago
  • Fixed bad JSON format for composer.json (this should fix travis build)
    By drgomesp, 6 years ago
  • Changed composer install command on travis ci config file
    By drgomesp, 6 years ago
  • Changed before_script from travis ci (do we really need to download the composer.phar file?)
    By drgomesp, 6 years ago
  • Changed travis-ci configurations
    By drgomesp, 6 years ago
  • Added composer.json file
    By drgomesp, 6 years ago