2017 © Pedro Peláez
 

library validation

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

image

siriusphp/validation

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  • Friday, June 1, 2018
  • by adrianmiu
  • Repository
  • 8 Watchers
  • 110 Stars
  • 184,552 Installations
  • PHP
  • 18 Dependents
  • 0 Suggesters
  • 22 Forks
  • 1 Open issues
  • 17 Versions
  • 4 % Grown

The README.md

Sirius Validation

Source Code Latest Version Software License Build Status Coverage Status Quality Score Total Downloads, (*1)

Sirius Validation is a library for data validation. It offers:, (*2)

  1. validator object
  2. 45 build-in validation rules. There are validators for strings, array, numbers, emails, URLs, files and uploads
  3. validation helper to simplify the validation of single values

Out-of-the-box, the library can handle arrays, ArrayObjects and objects that have implemented the toArray method. In order to validate other data containers you must create a DataWrapper so that the validator be able to extract data from your object., (*3)

Elevator pitch

$validator = new \Sirius\Validation\Validator;

// add a validation rule
$validator->add('title', 'required');

// add a rule that has a list of options
$validator->add('title', 'length', array('min' => 10, 'max' => 100));
// or use JSON
$validator->add('title', 'length', '{"min": 10, "max": 100}');
// or a URL query string
$validator->add('title', 'length', 'min=10&max=100');
// or, if you know that the validator can CORECTLY parse (ie: understand) the options string
$validator->add('title', 'length', '10,100');

// add a rule with a custom error message
$validator->add('title', 'maxlength', 'max=100', 'Article title must have less than {max} characters');

// add a rule with a custom message and a label (very handy with forms)
$validator->add('title:Title', 'maxlength', 'max=100', '{label} must have less than {max} characters');

// add multiple rules at once (separate using [space][pipe][space])
$validator->add('title:Title', 'required | maxlength(255) | minlength(min=10)');

// add all your rules at once
$validator->add([
        'title:Title' => 'required | maxlength(100)',
        'content:Content' => 'required',
        'source:Source' => 'website'
    ], [
        'content.required' => 'The content field should have a velue'
    ]);

// add nested rules
$validator->add('recipients[*]:Recipients', 'email'); //all recipients must be valid email addresses
$validator->add('shipping_address[city]:City', 'MyApp\Validator\City'); // uses a custom validator to validate the shipping city

The Versions

01/06 2018

dev-master

9999999-dev

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Adrian Miu

form validation security sanitization modeling

01/06 2018

2.2.2

2.2.2.0

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Adrian Miu

form validation security sanitization modeling

10/02 2018

2.2.1

2.2.1.0

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Adrian Miu

form validation security sanitization modeling

07/03 2017

2.2.0

2.2.0.0

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Adrian Miu

form validation security sanitization modeling

23/07 2016

2.1.2

2.1.2.0

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Adrian Miu

form validation security sanitization modeling

01/09 2015

2.1.1

2.1.1.0

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Adrian Miu

form validation security sanitization modeling

26/06 2015

2.1.0

2.1.0.0

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Adrian Miu

form validation security sanitization modeling

17/05 2015

2.0.0

2.0.0.0

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Adrian Miu

form validation security sanitization modeling

17/05 2015

dev-develop

dev-develop

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Adrian Miu

form validation security sanitization modeling

24/03 2015

1.2.5

1.2.5.0

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Adrian Miu

form validation security sanitization modeling

27/02 2015

1.2.4

1.2.4.0

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Adrian Miu

form validation security sanitization modeling

19/02 2015

1.2.3

1.2.3.0

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Adrian Miu

form validation security sanitization modeling

08/10 2014

1.2.2

1.2.2.0

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Adrian Miu

form validation security sanitization modeling

02/05 2014

1.2.1

1.2.1.0

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Adrian Miu

form validation security sanitization modeling

21/04 2014

1.2.0

1.2.0.0

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Adrian Miu

form validation security sanitization modeling

11/04 2014

1.1.1

1.1.1.0

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Adrian Miu

form validation security sanitization modeling

22/03 2014

1.1.0

1.1.0.0

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Adrian Miu

form validation security sanitization modeling