2017 © Pedro Peláez
 

library yav

Yet Another Validator for PHP. Simple, Stupid and totally framework independent.

image

victorium/yav

Yet Another Validator for PHP. Simple, Stupid and totally framework independent.

  • Friday, September 2, 2016
  • by jjmutumi
  • Repository
  • 0 Watchers
  • 0 Stars
  • 3 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Yet Another Validator (YAV) for PHP

Introduction

YAV is a very simple, stupid implementation framework agnostic library to validate and sanitize data., (*1)

Licence

All source files in YAV are released subject to the terms of the MIT license, as written in the included LICENSE.txt file., (*2)

Installation

Composer

YAV can be installed with composer (http://getcomposer.org/)., (*3)

  1. Install composer:, (*4)

    $ curl -s https://getcomposer.org/installer | php
    
  2. Require YAV as a dependency using composer:, (*5)

    $ php composer.phar require victorium/yaqb
    

Getting Started

This is a simple example on getting started with YAV:, (*6)

<?php

define("PATH_TO_YAV_SRC", dirname(__DIR__));

require PATH_TO_YAV_SRC . "/bootstrap.php";

use Yav\Processor\StrProcessor;

// all error messages are stored into here
$errors = [];

$myName = "\nJohn Doe";

$myName = StrProcessor::init(@$myName)
            ->required()
            ->strip()
            ->satisfies("/\s/")
            ->errorMessages("myName", $errors, [
                "required" => "Please enter your name",
                "satisfies" => "Please enter your full name",
            ])->value();

Features

YAV supports the following features:, (*7)

String processing

<?php

$data["place"] = StrProcessor::init(@$rawData["place"])
            ->required()
            ->strip()
            ->satisfies("/,/")
            ->errorMessages("place", $errors, [
                "required" => "Please enter the city and country",
                "satisfies" => "Please enter in the format: city,country",
            ])->value();

$data["country_code"] = StrProcessor::init(@$rawData["country_code"])
            ->required()
            ->maxLength(2)
            ->minLength(2)
            ->registerCallback(function (&$data, &$errors) {
                $data = strtoupper($data);
            })->errorMessages("country_code", $errors, [
                "required" => "Please enter the country code",
                "maxLength" => "Country codes are 2 letters",
                "minLength" => "Country codes are 2 letters",
            ])->value();

Integer and float processing

Date and time processing

Email processing

Phone number processing

File processing

The Versions

02/09 2016

dev-master

9999999-dev

Yet Another Validator for PHP. Simple, Stupid and totally framework independent.

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

validator another yet

02/09 2016

0.8.1

0.8.1.0

Yet Another Validator for PHP. Simple, Stupid and totally framework independent.

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

validator another yet

02/09 2016

0.8.0

0.8.0.0

Yet Another Validator for PHP. Simple, Stupid and totally framework independent.

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

validator another yet