respect / validation-bundle
Symfony RespectValidationBundle
Installs: 46
Dependents: 0
Suggesters: 0
Security: 0
Stars: 17
Watchers: 10
Forks: 3
Open Issues: 2
Type:symfony-bundle
Requires
- php: >=5.3.2
- respect/validation: ~0.9
- symfony/validator: ~2.6
Requires (Dev)
- phpunit/phpunit: ~4.6
This package is auto-updated.
Last update: 2024-11-24 04:21:40 UTC
README
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 //...