
====, (*1)
, (*2)
Install
composer install eden/validation
, (*3)
====, (*4)
, (*5)
Introduction
Instantiate validation in this manner., (*6)
$validation = eden('validation', 'foobar');
====, (*7)
, (*8)
API
====, (*9)
, (*10)
isType
Returns true if the value is a given type, (*11)
Usage
eden('validation', 'foo')->isType(*string $type, bool $soft);
Parameters
-
*string $type
- The data type to check for
-
bool $soft
- This is like == vs ===
Returns bool
, (*12)
Example
Example 1, (*13)
eden('validation', 'foo')->isType('email');
Example 2, (*14)
eden('validation', 'foo')->isType('url');
Example 3, (*15)
eden('validation', 'foo')->isType('hex');
Example 4, (*16)
eden('validation', 'foo')->isType('cc');
Example 5, (*17)
eden('validation', 'foo')->isType('int');
Example 6, (*18)
eden('validation', 'foo')->isType('float');
Example 7, (*19)
eden('validation', 'foo')->isType('bool');
====, (*20)
, (*21)
greaterThan
Returns true if the value is greater than the passed argument, (*22)
Usage
eden('validation', 'foo')->greaterThan(*int $number);
Parameters
-
*int $number
- Number to test against
Returns bool
, (*23)
Example
eden('validation', 'foo')->greaterThan(123);
====, (*24)
, (*25)
greaterThanEqualTo
Returns true if the value is greater or equal to than the passed argument, (*26)
Usage
eden('validation', 'foo')->greaterThanEqualTo(*int $number);
Parameters
-
*int $number
- Number to test against
Returns bool
, (*27)
Example
eden('validation', 'foo')->greaterThanEqualTo(123);
====, (*28)
, (*29)
lessThan
Returns true if the value is less than the passed argument, (*30)
Usage
eden('validation', 'foo')->lessThan(*int $number);
Parameters
-
*int $number
- Number to test against
Returns bool
, (*31)
Example
eden('validation', 'foo')->lessThan(123);
====, (*32)
, (*33)
lessThanEqualTo
Returns true if the value is less than or equal the passed argument, (*34)
Usage
eden('validation', 'foo')->lessThanEqualTo(*int $number);
Parameters
-
*int $number
- Number to test against
Returns bool
, (*35)
Example
eden('validation', 'foo')->lessThanEqualTo(123);
====, (*36)
, (*37)
lengthGreaterThan
Returns true if the value length is greater than the passed argument, (*38)
Usage
eden('validation', 'foo')->lengthGreaterThan(*int $number);
Parameters
-
*int $number
- Number to test against
Returns bool
, (*39)
Example
eden('validation', 'foo')->lengthGreaterThan(123);
====, (*40)
, (*41)
lengthGreaterThanEqualTo
Returns true if the value length is greater than or equal to the passed argument, (*42)
Usage
eden('validation', 'foo')->lengthGreaterThanEqualTo(*int $number);
Parameters
-
*int $number
- Number to test against
Returns bool
, (*43)
Example
eden('validation', 'foo')->lengthGreaterThanEqualTo(123);
====, (*44)
, (*45)
lengthLessThan
Returns true if the value length is less than the passed argument, (*46)
Usage
eden('validation', 'foo')->lengthLessThan(*int $number);
Parameters
-
*int $number
- Number to test against
Returns bool
, (*47)
Example
eden('validation', 'foo')->lengthLessThan(123);
====, (*48)
, (*49)
lengthLessThanEqualTo
Returns true if the value length is less than or equal to the passed argument, (*50)
Usage
eden('validation', 'foo')->lengthLessThanEqualTo(*int $number);
Parameters
-
*int $number
- Number to test against
Returns bool
, (*51)
Example
eden('validation', 'foo')->lengthLessThanEqualTo(123);
====, (*52)
, (*53)
notEmpty
Returns true if the value is not empty, (*54)
Usage
eden('validation', 'foo')->notEmpty();
Parameters
Returns bool
, (*55)
====, (*56)
, (*57)
startsWithLetter
Returns true if the value starts with a specific letter, (*58)
Usage
eden('validation', 'foo')->startsWithLetter();
Parameters
Returns bool
, (*59)
====, (*60)
, (*61)
alphaNumeric
Returns true if the value is alpha numeric, (*62)
Usage
eden('validation', 'foo')->alphaNumeric();
Parameters
Returns bool
, (*63)
====, (*64)
, (*65)
alphaNumericUnderScore
Returns true if the value is alpha numeric underscore, (*66)
Usage
eden('validation', 'foo')->alphaNumericUnderScore();
Parameters
Returns bool
, (*67)
====, (*68)
, (*69)
alphaNumericHyphen
Returns true if the value is alpha numeric hyphen, (*70)
Usage
eden('validation', 'foo')->alphaNumericHyphen();
Parameters
Returns bool
, (*71)
====, (*72)
, (*73)
alphaNumericLine
Returns true if the value is alpha numeric hyphen or underscore, (*74)
Usage
eden('validation', 'foo')->alphaNumericLine();
Parameters
Returns bool
, (*75)
====, (*76)
, (*77)
set
Sets the value to be validated, (*78)
Usage
eden('validation', 'foo')->set(*mixed $value);
Parameters
Returns Eden\Validation\Index
, (*79)
Example
eden('validation', 'foo')->set($value);
====, (*80)
, (*81)
Contributing to Eden
Contributions to Eden are following the Github work flow. Please read up before contributing., (*82)
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.