Skip to content

Yii2 component to move validation from forms to controllers. Useful for rest api.

Notifications You must be signed in to change notification settings

wbarcovsky/yii2-evalidator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

See tests.

$m = new EValidator([
	['email', 'email']
]);
// $m->setData([
// 	'email' => 'something'
// ]);
$object = new \StdClass;
$object->email = 'something';
$m->setData($object);

/**
* false
*/
var_dump($m->validate());

/**
* array(1) {
*   ["email"]=>
*   array(1) {
*     [0]=>
*     string(35) "Email is not a valid email address."
*   }
* }
*/
var_dump($m->getErrors());



$m->setData([
	'email' => 'something@gmail.com'
]);

/**
* true
*/
var_dump($m->validate());

About

Yii2 component to move validation from forms to controllers. Useful for rest api.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%