eden / validation
Eden validation component.
Installs: 8 429
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 13
Forks: 0
Open Issues: 0
Requires
- php: >=5.4.1
- eden/core: 4.*
README
====
Install
composer install eden/validation
====
Introduction
Instantiate validation in this manner.
$validation = eden('validation', 'foobar');
====
API
====
isType
Returns true if the value is a given type
Usage
eden('validation', 'foo')->isType(*string $type, bool $soft);
Parameters
*string $type
- The data type to check forbool $soft
- This is like == vs ===
Returns bool
Example
Example 1
eden('validation', 'foo')->isType('email');
Example 2
eden('validation', 'foo')->isType('url');
Example 3
eden('validation', 'foo')->isType('hex');
Example 4
eden('validation', 'foo')->isType('cc');
Example 5
eden('validation', 'foo')->isType('int');
Example 6
eden('validation', 'foo')->isType('float');
Example 7
eden('validation', 'foo')->isType('bool');
====
greaterThan
Returns true if the value is greater than the passed argument
Usage
eden('validation', 'foo')->greaterThan(*int $number);
Parameters
*int $number
- Number to test against
Returns bool
Example
eden('validation', 'foo')->greaterThan(123);
====
greaterThanEqualTo
Returns true if the value is greater or equal to than the passed argument
Usage
eden('validation', 'foo')->greaterThanEqualTo(*int $number);
Parameters
*int $number
- Number to test against
Returns bool
Example
eden('validation', 'foo')->greaterThanEqualTo(123);
====
lessThan
Returns true if the value is less than the passed argument
Usage
eden('validation', 'foo')->lessThan(*int $number);
Parameters
*int $number
- Number to test against
Returns bool
Example
eden('validation', 'foo')->lessThan(123);
====
lessThanEqualTo
Returns true if the value is less than or equal the passed argument
Usage
eden('validation', 'foo')->lessThanEqualTo(*int $number);
Parameters
*int $number
- Number to test against
Returns bool
Example
eden('validation', 'foo')->lessThanEqualTo(123);
====
lengthGreaterThan
Returns true if the value length is greater than the passed argument
Usage
eden('validation', 'foo')->lengthGreaterThan(*int $number);
Parameters
*int $number
- Number to test against
Returns bool
Example
eden('validation', 'foo')->lengthGreaterThan(123);
====
lengthGreaterThanEqualTo
Returns true if the value length is greater than or equal to the passed argument
Usage
eden('validation', 'foo')->lengthGreaterThanEqualTo(*int $number);
Parameters
*int $number
- Number to test against
Returns bool
Example
eden('validation', 'foo')->lengthGreaterThanEqualTo(123);
====
lengthLessThan
Returns true if the value length is less than the passed argument
Usage
eden('validation', 'foo')->lengthLessThan(*int $number);
Parameters
*int $number
- Number to test against
Returns bool
Example
eden('validation', 'foo')->lengthLessThan(123);
====
lengthLessThanEqualTo
Returns true if the value length is less than or equal to the passed argument
Usage
eden('validation', 'foo')->lengthLessThanEqualTo(*int $number);
Parameters
*int $number
- Number to test against
Returns bool
Example
eden('validation', 'foo')->lengthLessThanEqualTo(123);
====
notEmpty
Returns true if the value is not empty
Usage
eden('validation', 'foo')->notEmpty();
Parameters
Returns bool
====
startsWithLetter
Returns true if the value starts with a specific letter
Usage
eden('validation', 'foo')->startsWithLetter();
Parameters
Returns bool
====
alphaNumeric
Returns true if the value is alpha numeric
Usage
eden('validation', 'foo')->alphaNumeric();
Parameters
Returns bool
====
alphaNumericUnderScore
Returns true if the value is alpha numeric underscore
Usage
eden('validation', 'foo')->alphaNumericUnderScore();
Parameters
Returns bool
====
alphaNumericHyphen
Returns true if the value is alpha numeric hyphen
Usage
eden('validation', 'foo')->alphaNumericHyphen();
Parameters
Returns bool
====
alphaNumericLine
Returns true if the value is alpha numeric hyphen or underscore
Usage
eden('validation', 'foo')->alphaNumericLine();
Parameters
Returns bool
====
set
Sets the value to be validated
Usage
eden('validation', 'foo')->set(*mixed $value);
Parameters
*mixed $value
- value
Returns Eden\Validation\Index
Example
eden('validation', 'foo')->set($value);
====
Contributions to Eden are following the Github work flow. Please read up before contributing.
##Setting up your machine with the Eden repository and your fork
- Fork the repository
- Fire up your local terminal create a new branch from the
v4
branch of your fork with a branch name describing what your changes are. Possible branch name types:- bugfix
- feature
- improvement
- Make your changes. Always make sure to sign-off (-s) on all commits made (git commit -s -m "Commit message")
##Making pull requests
- Please ensure to run
phpunit
before making a pull request. - Push your code to your remote forked version.
- Go back to your forked version on GitHub and submit a pull request.
- An Eden developer will review your code and merge it in when it has been classified as suitable.