2017 © Pedro Peláez
 

library lib-validate

Validation helper with a shorthand syntax.

image

openlss/lib-validate

Validation helper with a shorthand syntax.

  • Tuesday, March 26, 2013
  • by nullivex
  • Repository
  • 1 Watchers
  • 0 Stars
  • 126 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

openlss/lib-validate

Validation helper with a shorthand syntax., (*1)

Usage

use \LSS\Validate;

$data = array('myparam'=>'valid string');

try {
    Validate::prime($data);
    Validate::go('myparam')->not('blank')->max(20)->is('alnum');
    Validate::paint();
} catch(Exception $e){
    echo $e;
}

Types

All these types will evaluate to true IF: * blank '' === true * empty empty() === true * null is_null($var) * ip var is IPv4 octect format * mac True if var is in mac address format (loose check for chars) * domain True if var is a domain name (loose check for chars) * num True if var is all numeric * dec True if the var is numeric with a decimal point * float Same as dec * alpha True if all characters are alpha-numeric * al Same as alpha * alu Same as alpha but with underscores (_) * als True if var is alphanumeric with spaces * alnums Alias to als * en Alias to als * email True if chars are valid for an email address * sha1 True if var is a sha1 hash * md5 True of var is a md5 hash, (*2)

Reference

(void) Validate::prime($data)

Prep validate with an array of data usualy from post(), (*3)

(object) Validate::go($var)

Starts a validation object for the given param, (*4)

(object) Validate::_get()

Returns the current instance, (*5)

(object) Validate::error($err)

Add error message to buffer This is generally used internally, (*6)

(object) Validate::setVar($var)

Sets the var to operate on This is generally used internally, (*7)

(string) Validate::get()

Retrieves the current variable This is generally used internally, (*8)

(object) Validate::min($min)

Checks that the current var is at minimum $min long, (*9)

(object) Validate::max($max)

Checks that the current var is at maximum $max long, (*10)

(object) Validate::not($type)

Checks that the current var is not given $type, (*11)

(object) Validate::is($type)

Checks that the current var is given #type, (*12)

(bool) Validate::paint()

If there are any errors in the buffer an exception will be raised Otherwise TRUE is returned, (*13)

The Versions

26/03 2013

dev-master

9999999-dev http://openlss.org

Validation helper with a shorthand syntax.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2

 

templating phptal tal

26/03 2013

dev-0.0.x-dev

dev-0.0.x-dev http://openlss.org

Validation helper with a shorthand syntax.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2

 

templating phptal tal

26/03 2013

0.0.3

0.0.3.0 http://openlss.org

Validation helper with a shorthand syntax.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2

 

templating phptal tal

26/03 2013

0.0.4

0.0.4.0 http://openlss.org

Validation helper with a shorthand syntax.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2

 

templating phptal tal

26/03 2013

0.0.5

0.0.5.0 http://openlss.org

Validation helper with a shorthand syntax.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2

 

templating phptal tal

26/03 2013

0.0.6

0.0.6.0 http://openlss.org

Validation helper with a shorthand syntax.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2

 

templating phptal tal

26/03 2013

0.0.2

0.0.2.0 http://openlss.org

Validation helper with a shorthand syntax.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2

 

templating phptal tal

24/03 2013

0.0.1

0.0.1.0 http://openlss.org

Validation helper with a shorthand syntax.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2

 

templating phptal tal