The Unofficial Selection
KnpLabs is hiring
Symfony2 developers!

Infos

Keywords

No keywords for this bundle

Score evolution

Score details ( ? )

  • Github Followers: 2
  • Last 30 days activity: 0
  • README file size: 5
  • Uses Travis CI: 0
  • Travis CI build status: 0
  • Provides a composer package: 0
  • KnpBundles recommendations: 0

Contributors

Latest commits

  • simplificado a instalação
    By gpupo 7 months ago
  • simplificado a instalação
    By gpupo 7 months ago
  • doc bundles/Respect/Validation-src
    By gpupo 8 months ago
  • unstable warning
    By gpupo 8 months ago
  • Readme fix path
    By gpupo 8 months ago
  • add respect.validator service
    By gpupo 8 months ago
  • add service
    By gpupo 8 months ago
  • add bin/vendors config
    By gpupo 8 months ago
  • add readme
    By gpupo 8 months ago
  • Initial commit
    By gpupo 8 months ago
7

RespectValidationBundle by gpupo

Symfony 2 Bundle for the most awesome validation engine ever created for PHP

TODO

1. Fix false validation on service

Installation

  1. Add reps to your deps file:

      [RespectValidationBundle]
          git=git://github.com/gpupo/RespectValidationBundle.git
          target=bundles/Respect/ValidationBundle  
      [RespectValidation]
            git=git://github.com/Respect/Validation.git
            target=Respect/Validation
    
  2. run bin/vendors install)

  3. Register the namespace Respect to your project's autoloader bootstrap script:

      //app/autoload.php
      $loader->registerNamespaces(array(
            // ...
            'Respect'    => __DIR__.'/../vendor/Respect/Validation/library',
            // ...
      ));
    

    4 Add this bundle to your application's kernel:

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

Usage

Use as service respect.validator (unstable):

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

Use as Alias:

    <?php

    namespace Acme\DemoBundle\Controller;

    use Symfony\Bundle\FrameworkBundle\Controller\Controller;
    use Respect\Validation\Validator as v;
    class HomeController extends Controller
    {

        public function indexAction()
        {

            $validUsername = v::alnum()
            ->noWhitespace()
            ->length(1,15);

            $x = $validUsername->validate('alganet'); //true

    //...

Documentation

See documentation on https://github.com/Respect/Validation

  • 2012-02-28 Marcelo Rodrigues

    A resolução desse problema é simples. Tanto a biblioteca quando o bundle compartilham o mesmo namespace (Respect), porém somente a biblioteca é registrada no namespace do autoload. Basta trocar a linha:

    'Respect' => __DIR__.'/../vendor/Respect/Validation/library',

    por:

    'Respect' => array(__DIR__.'/../vendor/Respect/Validation/library',__DIR__.'/../vendor/bundles')

  • 2012-02-14 Bruno Neves

    Estou tentando instalar mas não tive sucesso. Testei em ambiente mac e windows.

    Mesmo em uma instalação "limpa" do symfony 2 o erro abaixo acontece:

    Fatal error: Class 'Respect\ValidationBundle\RespectValidationBundle' not found in /Applications/MAMP/htdocs/Symfony/app/AppKernel.php on line 20

    Lembro que antigamente era necessário a criação de um link simbólico. Não seria este o problema? Teria como simularem de acordo com o que está documentado nesta página?

    Obrigado!