Readme formatting

This commit is contained in:
R. Eric Wheeler 2018-11-29 10:05:38 -08:00
parent c2a14193a5
commit 7bef10a2a5
1 changed files with 25 additions and 7 deletions

View File

@ -1,6 +1,14 @@
## Small library to generate unique private mac addresses # sikofitt/generate-mac
### Usage ### Small library to generate unique private mac addresses
#### Install
[composer](https://getcomposer.org)
```bash
composer require sikofitt/generate-mac
```
#### Usage
```php ```php
use Sikofitt\GenerateMac\Mac; use Sikofitt\GenerateMac\Mac;
@ -17,11 +25,11 @@ $address = $mac->getAddress(); // abcdef012345
If you don't care that it is unique you can remove the check for private mac prefixes. If you don't care that it is unique you can remove the check for private mac prefixes.
```php ```php
$mac = new Mac(':', false); $mac = new Mac(':', false);
$address = $mac->getAddress(); $address = $mac->getAddress();
// '52:54:00:ab:cd:ef', QEMU virtual NIC prefix 52:54:00 // '52:54:00:ab:cd:ef', QEMU virtual NIC prefix 52:54:00
// It's really not likely there will be a collision though. // It's really not likely there will be a collision though.
``` ```
Generate multiple mac addresses Generate multiple mac addresses
@ -43,4 +51,14 @@ var_dump($addresses);
* 9 => '32:73:c0:b3:62:27', * 9 => '32:73:c0:b3:62:27',
* ); * );
*/ */
``` ```
#### Test
```bash
user@localhost:~/generate-mac$ vendor/phpunit
```
#### License
[GPL-3.0](LICENSE)