ibandominguez/validator

validation class to take care of repetitive tasks

v1.2.1 2016-10-06 16:03 UTC

This package is not auto-updated.

Last update: 2024-05-01 18:44:59 UTC


README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

validator is a helper class for repetitive validation processes.

Getting Started

Clone or Download this package or install via composer

composer require ibandominguez/validator

Available Rules by '20/Jun/15'

Title Description
required check if the given input exists and it is not empty
email check if the given input is a valid email
array check if the given input is a valid array
numeric check if the given input is a numeric value
string check if the given input is a string value
date check if the given input is a date value with the format (yyyy-mm-dd)
datetime check if the given input is a datetime value with the format (yyyy-mm-dd hh:ii:ss)
time check if the given input is a time value with the format (hh:ii:ss)

Rules Roadmap

  • min
  • max
  • between
  • date format
  • alpha
  • alpha numeric

Use example

In your application:

<?php

require __DIR__.'/vendor/autoload.php';

$inputs = array('name' => '', 'email' => 'johndoe@email.com');
$rules = array('name' => 'required', 'email' => 'required|email');

$v = new IbanDominguez\Validator\Validator($inputs, $rules);

$v->passes(); // => false
$v->getErrors(); // => array('name' => 'name, rule: required');

License

MIT © Ibán Domínguez