Skip to content
Permalink
Browse files

Adding the required changes to to a subtree split of the validation l…

…ibrary
  • Loading branch information...
lorenzo committed Aug 25, 2014
1 parent 55cf771 commit 22584362be32cd921079ce17f7eea338a345e957
Showing with 53 additions and 1 deletion.
  1. +2 −1 composer.json
  2. +34 −0 src/Validation/README.md
  3. +17 −0 src/Validation/composer.json
@@ -41,6 +41,7 @@
},
"replace": {
"cakephp/collection": "self.version",
"cakephp/event": "self.version"
"cakephp/event": "self.version",
"cakephp/validation": "self.version"
}
}
@@ -0,0 +1,34 @@
# 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:

```php
use Cake\Validation\Validator;
$validator = new Validator();
$validator
->validatePresence('email')
->add('email', 'validFormat', [
'rule' => 'email',
'message' => 'E-mail must be valid'
])
->validatePresence('name')
->notEmpty('name', 'We need your name.')
->validatePresence('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](http://book.cakephp.org/3.0/en/core-libraries/validation.html)
@@ -0,0 +1,17 @@
{
"name": "cakephp/validation",
"description": "CakePHP Validation library",
"license": "MIT",
"authors": [
{
"name": "CakePHP Community",
"homepage": "http://cakephp.org"
}
],
"autoload": {
"psr-4": {
"Cake\\Validation\\": "."
}
},
"minimum-stability": "beta"
}

0 comments on commit 2258436

Please sign in to comment.
You can’t perform that action at this time.