A library that implements the php-extended/php-ip-object-interface interface library.
A library that implements the php-extended/php-ip-object-interface interface library.
The installation of this library is made via composer.
Download composer.phar
from their website.
Then add to your composer.json :
"require": {
...
"php-extended/php-mac-parser-object": "^2",
...
}
Then run php composer.phar update
to install this library.
The autoloading of all classes of this library is made through composer's autoloader.
You may use this library this following way:
use PhpExtended\Mac\MacAddress48Bits;
use PhpExtended\Mac\ParseException;
$addr = '<put your mac address here>'; // "ff:ff:ff:ff:ff:ff" format
try
{
$mac = new MacAddress48Bits($addr);
}
catch(ParseException $e)
{
// does something
}
You can get back the first three bytes as integer with the $mac->getOui()
method and the three last bytes as integer with the $mac->getNic()
method.
MIT (See license file).