hylianshield / validator-alphabet
Validator to validate messages against a given alphabet
1.0.1
2017-01-01 15:04 UTC
Requires
- php: ^7.0
- hylianshield/alphabet: ^1.0.0
- hylianshield/validator-pcre: ^1.0.0
Requires (Dev)
- phpunit/phpunit: ^5.7.5
This package is auto-updated.
Last update: 2024-11-29 04:57:59 UTC
README
The alphabet validator is a validator that will validate given messages against a configured alphabet.
Installation
composer require hylianshield/validator-alphabet:^1.0
Usage
The alphabet validator accepts an alphabet instance. It is based on the PCRE validator.
<?php use \HylianShield\Alphabet\Alphabet; use \HylianShield\Validator\Alphabet\AlphabetValidator; $alphabet = new Alphabet('A', 'B', 'C'); $validator = new AlphabetValidator($alphabet); echo $validator->getIdentifier();
Outputs:
pcre(/^[ABC]*$/)
Testing
To run the unit tests, to check the code, simply run one of the pre-configured composer scripts:
composer test
Runs PHPUnitcomposer coverage
Runs PHPUnit with text coveragecomposer coverage-html
Runs PHPUnit with HTML coverage and opens the result in the browser.