antalaron / regex-validator
PHP library to validate regular expressions
Installs: 3 165
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.4|^8.0
- symfony/validator: ^4.4|^5.0|^6.0
Requires (Dev)
Conflicts
- phpunit/phpunit: <4.8.35|<5.4.3,>=5.0
This package is auto-updated.
Last update: 2024-10-29 05:22:25 UTC
README
PHP library to validate regular expressions.
Installation
Open a command console, enter your project directory and execute the following command to download the latest stable version of this library:
$ composer require antalaron/regex-validator
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Basic usage
To validate a regular expression:
use Antalaron\RegexValidator\Regex; use Symfony\Component\Validator\Validation; $validator = Validation::createValidator(); $violations = $validator->validate('/foo/', new Regex()); if (0 !== count($violations)) { foreach ($violations as $violation) { echo $violation->getMessage().'<br>'; } }
License
This library is under MIT License.