hylianshield / validator-alphabet
Validator to validate messages against a given alphabet
Installs: 70
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/hylianshield/validator-alphabet
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: 2025-09-29 01:45:19 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.