Skip to content

[READ-ONLY] Validation library from CakePHP. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp

License

Notifications You must be signed in to change notification settings

cakephp/validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d1c2ca7 · Mar 25, 2021
Dec 29, 2020
Oct 18, 2020
May 11, 2020
May 7, 2019
Mar 25, 2021
Dec 3, 2020
Mar 18, 2020
Oct 13, 2020
Sep 8, 2019
Feb 7, 2020
May 10, 2019

Repository files navigation

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')
    ->notEmptyString('name', 'We need your name.')
    ->requirePresence('comment')
    ->notEmptyString('comment', 'You need to give a comment.');

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

Documentation

Please make sure you check the official documentation

About

[READ-ONLY] Validation library from CakePHP. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages