-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add the List of Predefined Rules in readme as documentation
- Loading branch information
1 parent
de94ea7
commit 8ed0541
Showing
1 changed file
with
13 additions
and
11 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 |
---|---|---|
|
@@ -22,18 +22,15 @@ use BlakvGhost\PHPValidator\ValidatorException; | |
|
||
try { | ||
|
||
// $validator = new Validator($_POST, [ | ||
// 'username' => 'required|string:25', | ||
// 'email' => 'required|email', | ||
// 'score' => ['required','max_length:200', new CustomRule()], | ||
// ]); | ||
// or | ||
|
||
$validator = new Validator([ | ||
$data = [ | ||
'username' => 'BlakvGhost', | ||
'email' => '[email protected]', | ||
'score' => 42, | ||
], [ | ||
]; | ||
// or | ||
// $data = $_POST; | ||
|
||
$validator = new Validator($data, [ | ||
'username' => 'required|string:25', | ||
'email' => 'required|email', | ||
'score' => ['required','max_length:200', new CustomRule()], | ||
|
@@ -218,10 +215,15 @@ use YourNameSpace\CustomPasswordRule; | |
// ... | ||
|
||
try { | ||
$validator = new Validator([ | ||
|
||
$data = [ | ||
'password' => '42', | ||
'confirm_password' => '142', | ||
], [ | ||
]; | ||
// or | ||
// $data = $_POST; | ||
|
||
$validator = new Validator($data, [ | ||
'password' => ['required', new CustomPasswordRule()], | ||
]); | ||
|
||
|