2017 © Pedro Peláez
 

library validation

The power of 'Respect Validation' on Laravel.

image

kennedytedesco/validation

The power of 'Respect Validation' on Laravel.

  • Sunday, February 18, 2018
  • by KennedyTedesco
  • Repository
  • 12 Watchers
  • 165 Stars
  • 32,099 Installations
  • PHP
  • 1 Dependents
  • 1 Suggesters
  • 25 Forks
  • 0 Open issues
  • 20 Versions
  • 4 % Grown

The README.md

kennedytedesco/validation

The power of Respect Validation on Laravel., (*1)

Build Status Total Downloads Latest Stable Version License, (*2)

Version Compatibility

Laravel kennedytedesco/validation
9.x composer require kennedytedesco/validation:^9.0
8.x composer require kennedytedesco/validation:^8.0
7.x composer require kennedytedesco/validation:^7.0
6.x composer require kennedytedesco/validation:^6.0
5.8.x composer require kennedytedesco/validation:^5.0
5.7.x composer require kennedytedesco/validation:^5.0
5.6.x composer require kennedytedesco/validation:^5.0
5.5.x composer require kennedytedesco/validation:^5.0

Installation

composer require kennedytedesco/validation:^9.0

Supported rules (with examples)

$rules = [
    'cpf'               => ['cpf',],
    'cnpj'              => ['cnpj',],
    'cnh'               => ['cnh',],
    'minimumAge'        => ['minimumAge:20',],
    'callback'          => ['callback:is_int',],
    'charset'           => ['charset:ASCII',],
    'consonant'         => ['consonant',],
    'vowel'             => ['vowel',],
    'alnum'             => ['alnum:-',],
    'digit'             => ['digit',],
    'alpha'             => ['alpha',],
    'containsArray'     => ['contains:banana',],
    'contains'          => ['contains:banana',],
    'countryCode'       => ['countryCode',],
    'creditCard'        => ['digit', 'creditCard',],
    'domain'            => ['domain',],
    'directory'         => ['directory',],
    'fileExists'        => ['fileExists',],
    'isFile'            => ['file',],
    'endsWith'          => ['endsWith:banana',],
    'equals'            => ['equals:banana',],
    'even'              => ['even',],
    'floatVal'          => ['floatVal',],
    'float'             => ['floatVal',],
    'graph'             => ['graph',],
    'instance'          => ['instance:DateTime',],
    'int'               => ['int',],
    'json'              => ['json',],
    'leapDate'          => ['leapDate:Y-m-d',],
    'leapYear'          => ['leapYear',],
    'arrayVal'          => ['arrayVal',],
    'Arr'               => ['arrayVal',],
    'lowercase'         => ['lowercase',],
    'macAddress'        => ['macAddress',],
    'multiple'          => ['multiple:3',],
    'negative'          => ['negative',],
    'noWhitespace'      => ['noWhitespace',],
    'nullValue'         => ['nullValue',],
    'numeric'           => ['numeric',],
    'objectType'        => ['objectType',],
    'odd'               => ['odd',],
    'perfectSquare'     => ['perfectSquare',],
    'positive'          => ['positive',],
    'primeNumber'       => ['primeNumber',],
    'punct'             => ['punct',],
    'readable'          => ['readable',],
    'regex'             => ['regex:/5/',],
    'roman'             => ['roman',],
    'slug'              => ['slug',],
    'space'             => ['space:b',],
    'tld'               => ['tld',],
    'uppercase'         => ['uppercase',],
    'version'           => ['version',],
    'xdigit'            => ['xdigit',],
    'writable'          => ['writable',],
    'alwaysValid'       => ['alwaysValid',],
    'boolType'          => ['boolType',],
    'youtube'           => ['videoUrl:youtube',],
    'vimeo'             => ['videoUrl:vimeo',],
    'video1'            => ['videoUrl',],
    'video2'            => ['videoUrl',],
];

$data = [
    'cpf'               => '22205417118',
    'cnpj'              => '68518321000116',
    'cnh'               => '02650306461',
    'callback'          => 20,
    'charset'           => 'acucar',
    'consonant'         => 'dcfg',
    'vowel'             => 'aeiou',
    'alnum'             => 'banana-123 ',
    'digit'             => '120129  21212',
    'alpha'             => 'banana',
    'containsArray'     => ['www', 'banana', 'jfk', 'http',],
    'contains'          => 'www banana jfk http',
    'countryCode'       => 'BR',
    'creditCard'        => '5555666677778884',
    'domain'            => 'google.com.br',
    'directory'         => __DIR__,
    'fileExists'        => __FILE__,
    'file'              => __FILE__,
    'endsWith'          => 'pera banana',
    'equals'            => 'banana',
    'even'              => 8,
    'floatVal'          => 9.8,
    'graph'             => 'LKM@#$%4;',
    'instance'          => new \Datetime(),
    'int'               => 9,
    'json'              => '{"file":"laravel.php"}',
    'leapDate'          => '1988-02-29',
    'leapYear'          => '1988',
    'arrayVal'          => ['Brazil',],
    'lowercase'         => 'brazil',
    'macAddress'        => '00:11:22:33:44:55',
    'multiple'          => '9',
    'negative'          => '-10',
    'noWhitespace'      => 'laravelBrazil',
    'nullValue'         => null,
    'numeric'           => '179.9',
    'objectType'        => new \stdClass(),
    'odd'               => 3,
    'perfectSquare'     => 25,
    'positive'          => 1,
    'primeNumber'       => 7,
    'punct'             => '&,.;[]',
    'readable'          => __FILE__,
    'regex'             => '5',
    'roman'             => 'VI',
    'slug'              => 'laravel-brazil',
    'space'             => '              b      ',
    'tld'               => 'com',
    'uppercase'         => 'BRAZIL',
    'version'           => '1.0.0',
    'xdigit'            => 'abc123',
    'writable'          => __FILE__,
    'alwaysValid'       => '@#$_',
    'boolType'          => \is_int(2),
    'youtube'           => 'http://youtu.be/l2gLWaGatFA',
    'vimeo'             => 'http://vimeo.com/33677985',
    'video1'            => 'https://youtu.be/l2gLWaGatFA',
    'video2'            => 'https://vimeo.com/33677985',
];

$validator = \Validator::make($data, $rules);

if ($validator->passes()) {
    // Do something
}

For more validation rules

See all available rules here:, (*3)

https://respect-validation.readthedocs.io/en/1.1/list-of-rules/, (*4)

Repository of Respect Validation:, (*5)

https://github.com/Respect/Validation, (*6)

The Versions

18/02 2018

dev-master

9999999-dev

The power of 'Respect Validation' on Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

18/02 2018

5.1.0

5.1.0.0

The power of 'Respect Validation' on Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

19/09 2017

5.0.0

5.0.0.0

The power of 'Respect Validation' on Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

30/01 2017

4.0.0

4.0.0.0

The power of 'Respect Validation' on Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

30/01 2017

4.0.x-dev

4.0.9999999.9999999-dev

The power of 'Respect Validation' on Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

08/09 2016

3.0.1

3.0.1.0

The power of 'Respect Validation' on Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

22/12 2015

3.0.0

3.0.0.0

The power of 'Respect Validation' on Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

30/11 2015

2.0.x-dev

2.0.9999999.9999999-dev

The power of 'Respect Validation' on Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

29/11 2015

2.1.0

2.1.0.0

The power of 'Respect Validation' on Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

09/06 2015

2.0.4

2.0.4.0

The power of 'Respect Validation' on Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

09/06 2015

dev-L4

dev-L4

The power of 'Respect Validation' on Laravel 4 Validation.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

09/06 2015

v1.2.1

1.2.1.0

The power of 'Respect Validation' on Laravel 4 Validation.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

26/05 2015

2.0.3

2.0.3.0

The power of 'Respect Validation' on Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

07/03 2015

v1.2.0

1.2.0.0

The power of 'Respect Validation' on Laravel 4 Validation.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

21/02 2015

2.0.2

2.0.2.0

The power of 'Respect Validation' on Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

14/02 2015

2.0.1

2.0.1.0

The power of 'Respect Validation' on Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

14/02 2015

2.0.0

2.0.0.0

The power of 'Respect Validation' on Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

10/02 2014

1.1

1.1.0.0

The power of 'Respect Validation' on Laravel 4 Validation.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

24/08 2013

v1.0

1.0.0.0

The power of 'Respect Validation' on Laravel 4 Validation.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect

15/08 2013

v1.0-beta.1

1.0.0.0-beta1

The power of 'Respect Validation' on Laravel 4 Validation.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kennedy Tedesco

laravel validation rules respect