php-extended / php-mac-object
A library that implements the php-extended/php-mac-interface interface library
7.0.6
2024-07-31 13:38 UTC
Requires
- php: >=8.0
- php-extended/php-mac-interface: ^7
- php-extended/php-parser-lexer: ^7
Requires (Dev)
- dev-master
- 7.0.6
- 7.0.5
- 7.0.4
- 7.0.3
- 7.0.2
- 7.0.1
- 7.0.0
- 6.0.7
- 6.0.6
- 6.0.5
- 6.0.4
- 6.0.3
- 6.0.2
- 6.0.1
- 6.0.0
- 5.0.1
- 5.0.0
- 4.0.2
- 4.0.1
- 4.0.0
- 3.3.8
- 3.3.7
- 3.3.6
- 3.3.5
- 3.3.4
- 3.3.3
- 3.3.2
- 3.3.1
- 3.3.0
- 3.2.18
- 3.2.17
- 3.2.16
- 3.2.15
- 3.2.14
- 3.2.13
- 3.2.12
- 3.2.11
- 3.2.10
- 3.2.9
- 3.2.8
- 3.2.7
- 3.2.6
- 3.2.5
- 3.2.4
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.1
- 3.0.0
- 2.0.2
- 2.0.1
- 2.0.0
This package is auto-updated.
Last update: 2024-10-31 00:23:24 UTC
README
A library that implements the php-extended/php-mac-interface interface library.
Installation
The installation of this library is made via composer and the autoloading of all classes of this library is made through their autoloader.
- Download
composer.phar
from their website. - Then run the following command to install this library as dependency :
php composer.phar php-extended/php-mac-object ^7
Basic Usage
You may use this library this following way:
use PhpExtended\Mac\MacAddress48Bits;
use PhpExtended\Mac\ParseException;
$mac = new MacAddress48Bits(0xffffff, 0xffffff);
To parse the mac addresses, do :
use PhpExtended\Mac\MacAddress48Parser;
use PhpExtended\Parser\ParseException;
$parser = new MacAddress48Parser();
$addr = '<put your mac address here>'; // "ff:ff:ff:ff:ff:ff" format
try
{
$mac = $parser->parse($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.
License
MIT (See license file).