| Recommend this page to a friend! |
| Info | Documentation | Reputation | Support forum | Blog | Links |
| Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
| 2024-06-22 (9 months ago) | Not enough user ratings | Total: 55 | All time: 10,609 This week: 68 | |||||
| Version | License | PHP version | Categories | |||
| generalvalidator 1.0 | MIT/X Consortium ... | 5 | Validation, PHP 7 |
| Description | Author | |
This package can validate text strings of different types of values. |
General string validation. Currently Email address, string length, password, url and country code validation. Easily extendable with others.
$validator = PasswordValidator(3); // Minimum password score 3
if ($validator->validate("my-very-long-password-is-good")) {
// Good, your password is strong enough
}
Classes:
Validator() // Parent for all classes
EmailValidator()
UrlValidator()
CountryCodeValidator()
LengthValidator(int $minLength, int $maxLength)
PasswordValidator(int $minScore) // Score from 0 (weakest) to 4 (strongest)
Methods:
Validator::validate(string) // Pass in the test string and returns bool
Validator::load() // Shorthand class loader
Validator::getValue() // Returns the output of the validator, null if no output
Validator::getError() // Returns the error from the validator, null if no error
StringValidator::setMin(int) // Update the min string length
StringValidator::setMax(int) // Update the max string length
PasswordValidator::setMinScore(int) // Update the min password score required for a pass```
Tests are provided in test/ValidatorTest.php and can be run with PHPUnit
BSD 2-Clause License - See LICENSE
| File | Role | Description | ||
|---|---|---|---|---|
| Data | Auxiliary data | |||
| Data | Auxiliary data | |||
| Lic. | License text | |||
| Doc. | Documentation | |||
| / | Validators |
| File | Role | Description |
|---|---|---|
| |
Class | Class source |
| |
Class | Class source |
| |
Class | Class source |
| |
Class | Class source |
| |
Class | Class source |
| |
Class | Class source |
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
| Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
| 100% |
|
|
| Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.