symfony-bundle validation-bundle
Symfony AntkowiakValidationBundle
antkowiak/validation-bundle
Symfony AntkowiakValidationBundle
- Thursday, March 24, 2016
- by antkowiak
- Repository
- 1 Watchers
- 0 Stars
- 3 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 0 % Grown
Installation
Step 1: Composer require
composer require antkowiak/validation-bundle dev-master
Step 2: Enable the bundle
new Antkowiak\ValidationBundle\AntkowiakValidationBundle()
Usage
$validator = $this->get('antkowiak.validator');
$object = new Object(); //Object with assert on fields.
$object->setEmail('1');
$validator->isValid($object); //boolean
$validator->getMessages($object); //array with messages
Example messages array:
array:2 [
"user" => array:1 [
0 => "Ta wartość nie powinna być pusta."
]
"name" => array:2 [
0 => "Ta wartość nie jest prawidłowym adresem email."
1 => "Ta wartość jest zbyt krótka. Powinna mieć 3 lub więcej znaków."
]
]
License
This bundle is released under the MIT license. See the complete license in the
bundle:, (*1)
Resources/meta/LICENSE