Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2024-06-22 (3 months ago) | Not yet rated by the users | Total: 54 | All time: 10,614 This week: 59 |
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
Files (11) |
File | Role | Description | ||
---|---|---|---|---|
test (1 file) | ||||
Validators (6 files) | ||||
composer.json | Data | Auxiliary data | ||
composer.lock | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
README.md | Doc. | Documentation |
Files (11) | / | Validators |
File | Role | Description |
---|---|---|
CountryCodeValidator.php | Class | Class source |
EmailValidator.php | Class | Class source |
LengthValidator.php | Class | Class source |
PasswordValidator.php | Class | Class source |
UrlValidator.php | Class | Class source |
Validator.php | 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. |
Install with Composer |
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.