Skip to content

Instantly share code, notes, and snippets.

@tassoevan
Created May 6, 2013 00:08
Show Gist options
  • Save tassoevan/5522665 to your computer and use it in GitHub Desktop.
Save tassoevan/5522665 to your computer and use it in GitHub Desktop.
Easy access to \Respect\Validation\Validator class
<?php
// Author's recommendation
use Respect\Validation\Validator as v;
$number = 123;
v::numeric()->validate($number); //true
// The author method can be a little uncomfortable, because
// the 'v' alias will be present in all source code and it
// is meaningless according OOP.
// Here my approach
$v = 'Respect\Validation\Validator';
$number = 123;
$v::numeric()->validate($number); //true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment