Installation

Download with Composer

$ composer require awurth/slim-validation

Configure the validator

To initialize the validator, create a new instance of Awurth\SlimValidation\Validator

Validator::__construct([ bool $showValidationRules = true [, array $defaultMessages = [] ]])

$showValidationRules

$defaultMessages

An array of messages to overwrite the default Respect Validation messages

$defaultMessages = [
'length' => 'This field must have a length between {{minValue}} and {{maxValue}} characters',
'notBlank' => 'This field is required'
];

Add the validator as a service

You can add the validator to the app container to access it easily through your application

$container['validator'] = function () {
return new Awurth\SlimValidation\Validator();
};