-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from berry-langerak/feature/introducing-docs
Feature/introducing docs
- Loading branch information
Showing
7 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Extending Validator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Particle Validator | ||
|
||
Particle\Validator is a small and elegant validation library, with an extremely clean API | ||
which makes validation **fun**! | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Installation | ||
|
||
Installing Particle\Validator is very easy, if you're using [composer](http://getcomposer.com). | ||
If you haven't done so, install composer, and use `composer require` to install Particle\Validator. | ||
|
||
```bash | ||
curl -sS https://getcomposer.org/installer | php | ||
php composer.phar require particle/validator | ||
``` | ||
|
||
## First usage | ||
|
||
To make sure all Particle\Validator classes can be autoloaded, you have to include "vendor/autoload.php": | ||
|
||
```php | ||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
||
$v = new Particle\Validator; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Overwriting the default messages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Default rules | ||
|
||
There is a large number of default rules in Particle\Validator. | ||
|
||
## Required and allowEmpty | ||
|
||
Required and optional are special cases within Particle\Validator. They are only about whether or not the *key* is | ||
required, not the value. In case of a non-required value, you may use allowEmpty, which is the third parameter to | ||
`required` and `optional`. | ||
|
||
## List of rules | ||
|
||
### alnum($allowWhitespace = false) | ||
|
||
Validate the value to consist only out of alphanumeric characters. | ||
|
||
### alpha($allowWhitespace = false) | ||
|
||
Validate that the value only consists our of alphabetic characters. | ||
|
||
### between($min, $max, $inclusive = true) | ||
|
||
Validate that the value is between $min and $max (inclusive by default). | ||
|
||
### callback(callable $callable) | ||
|
||
Validate by executing a callback function, and returning its result. | ||
|
||
### datetime($format = null) | ||
|
||
Validates that the value is a date. If format is passed, it *must* be in that format. | ||
|
||
### digits() | ||
|
||
Validates that all characters of the value are decimal digits. | ||
|
||
### integer() | ||
|
||
Validates the value represents a valid integer | ||
|
||
### email() | ||
|
||
Validates that the value is a valid email address (format only). | ||
|
||
### equals($value) | ||
|
||
Validates that the value is equal to $value. | ||
|
||
### inArray(array $array, $strict = true) | ||
|
||
Validates that the value is in the array with optional "loose" checking. | ||
|
||
### length($length) | ||
|
||
Validate the value to be of precisely length $length. | ||
|
||
### lengthBetween($min, $max, $inclusive = true) | ||
|
||
Validates that the length of the value is between $min and $max. | ||
If $max is null, it has no upper limit. The default is inclusive. | ||
|
||
### regex($regex) | ||
|
||
Validates that the value matches the regular expression $regex. | ||
|
||
### url() | ||
|
||
Validates that the value is a valid URL. | ||
|
||
### required(callable $callback) | ||
|
||
Set a callable which may be used to alter the required requirement on validation time. | ||
This may be incredibly helpful when doing conditional validation. | ||
|
||
### allowEmpty(callable $callback) | ||
|
||
Set a callable which may be used to alter the allow empty requirement on validation time. | ||
This may be incredibly helpful when doing conditional validation. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
site_name: Particle Validator | ||
theme: readthedocs | ||
pages: | ||
- [index.md, Home] | ||
- [installation.md, Installing] | ||
- [rules.md, Default rules] | ||
- [messages.md, Overwriting messages] | ||
- [extending.md, Extending the Validator] | ||
|