ndm2 0aeef36d28 No else statement required. 7 years ago
..
LICENSE.txt c61ab5ee95 Use HTTPS for the cakefoundation.org URL 8 years ago
README.md fe1d812c89 Update URL in *.md, *.json 9 years ago
RulesProvider.php 3630964f96 Add missing @throws in phpDocs 8 years ago
ValidatableInterface.php 3a6bd75832 Use HTTPS for the opensource.org URL 8 years ago
Validation.php 0aeef36d28 No else statement required. 7 years ago
ValidationRule.php 3a6bd75832 Use HTTPS for the opensource.org URL 8 years ago
ValidationSet.php 5f3a304ab3 Fix errors reported by phpstan. 8 years ago
Validator.php 86194c5d22 Fix all phpDocs @throws FQN 8 years ago
ValidatorAwareInterface.php 2e36fa644c Added a ValidatorAwareInterface. 8 years ago
ValidatorAwareTrait.php 660f9642b8 Always use consistent class usage to make comparison and detection/refactor possible. 8 years ago
composer.json 8400540c75 Add missing core dependencies and bump versions. 8 years ago

README.md

Total Downloads License

CakePHP Validation Library

The validation library in CakePHP provides features to build validators that can validate arbitrary arrays of data with ease.

Usage

Validator objects define the rules that apply to a set of fields. Validator objects contain a mapping between fields and validation sets. Creating a validator is simple:

use Cake\Validation\Validator;

$validator = new Validator();
$validator
    ->requirePresence('email')
    ->add('email', 'validFormat', [
        'rule' => 'email',
        'message' => 'E-mail must be valid'
    ])
    ->requirePresence('name')
    ->notEmpty('name', 'We need your name.')
    ->requirePresence('comment')
    ->notEmpty('comment', 'You need to give a comment.');

$errors = $validator->errors($_POST);
if (!empty($errors)) {
    // display errors.
}

Documentation

Please make sure you check the official documentation