2017 © Pedro Peláez
 

library validators

A simple type validator.

image

almendra/validators

A simple type validator.

  • Friday, October 7, 2016
  • by rickynroses87
  • Repository
  • 1 Watchers
  • 1 Stars
  • 44 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Build Status Scrutinizer Code Quality SensioLabsInsight, (*1)

Installation

Through composer:, (*2)

composer require almendra/validators

How to use it

    1. Stand alone
$validator = new Validator(); 
$result = $validator 
    -> integer(10)
    -> min(3)
    -> max(20)
    -> validate();
    1. Within a controller
# SomeController extends Http\Controller or implements Http\Interfaces\ControllerInterface
$controller = new SomeController; 
$controller -> validate(function($request, $validator) {
    $result = $validator 
    -> string($request -> get('name'))
    -> min(3)
    -> max(20)
    -> validate();

    return $result;
});

It can also be used with a type homogeneus array:, (*3)

$validator = new Validator(); 
$result = $validator 
    -> string($request -> all())
    -> range(1, 255)
    -> validate();

Support

Currently, the validator supports the following types: integer, string, double, float, file, (*4)

The Versions

07/10 2016

dev-master

9999999-dev

A simple type validator.

  Sources   Download

MIT

The Development Requires