alexsawallich / zend-validator-macaddress
dev-master
2019-03-03 23:58 UTC
Requires
- zendframework/zend-validator: ^2.12
Requires (Dev)
- phpunit/phpunit: ^6.5
This package is auto-updated.
Last update: 2024-12-04 12:27:39 UTC
README
zend-validator-macaddress
Validation class to validate MAC addresses for plugging in right into Zend Framework 3.
Installation
The validator can be installed via composer as it is registered with packagist:
composer require alexsawallich/zend-validator-macaddress
Getting started
The simplest way of using the validator looks as follows:
<?php
$validator = new AlexSawallich\Validator\MacAddress();
$isValid = $validator->isValid('FE:34:ED:32:2F:F4');
var_dump($isValid);
if (false === $isValid) {
var_dump($validator->getMessages());
}
Options
The validator comes with a variety of options. All these options are set to true
by default. The options
can be typically given into the constructor as array, as you could do with all zend validator classes.
For each options there's also a getter and a setter method, like setAllowColonNotation()
.