Details
Tech Stack
Download Instruction
-
Clone the project.
git clone https://github.com/infinitypaul/quest.git projectname
-
Install dependencies via composer.
composer install
-
Run php server.
php -S localhost:8000
-
Sample Response
-
Sample Code
$check = new \App\Checkers\Check([
'name' => '',
'email' => [
'infinitypaul@live.com',
'',
'ade',
'ade@google.com'
],
'password' => 'eeee'
]);
$check->setRules([
'name' => [
'required'
],
'email.*' => [
new \App\Checkers\Rules\Required(),
'email',
'blacklist'
],
'password' => [
'min:5',
'sequence'
]
]);
if(!$check->validate()){
dump($check->getErrors());
} else {
dump("passed");
};
You can either define your rules as a class
new \App\Checkers\Rules\Required(),
or as a string
required
you can also define your own rule by extending the Rule Class
class EmailRule extends Rule
{
/
* @param $field
* @param $value
* @return bool
*/
public function passes($field, $value): bool
{
return filter_var($value, FILTER_VALIDATE_EMAIL);
}
/
* @param $field
* @return string
*/
public function message($field): string
{
return ucwords($field. ' Must Be A Valid Email Address');
}
}
If you prefer it to br string base, you can define it in the RuleMap.php
'email' => EmailRule::class
Organization Password Policy
The service is very flexible, and new rules can be added without much code.
What is needed is to create a new rule, extend the RULE class, and define all your conditions and organization password policy like the one below
-
Password/Passphrase Length Policy
-
Password Deny List
-
Password Combination
-
Password Checks to be sure it isn't part of the leaked password
|
Name: |
Quest PHP Validation Library |
Base name: |
quest |
Description: |
Validate values with general and custom rules |
Version: |
1.0.0 |
PHP version: |
5 |
License: |
The PHP License |
|
|
|
Screenshots |
|
|
File |
Role |
Description |
img.png |
Screen |
Screenshot |
|
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.
|
Files |
|
File |
Role |
Description |
Checkers (2 files, 2 directories) |
File |
Role |
Description |
Errors.php |
Class |
Class source |
|
Files |
|
File |
Role |
Description |
Checkers (2 files, 2 directories) |
File |
Role |
Description |
Errors.php |
Class |
Class source |