option/mac

一个用于包含MAC地址的类

0.5.0 2023-10-16 17:56 UTC

This package is not auto-updated.

Last update: 2024-10-01 20:39:17 UTC


README

了解更多关于MAC地址的信息: https://en.wikipedia.org/wiki/MAC_address

支持多种输入和输出格式;十六进制字符串、整数、字节

提取有关MAC地址的各种信息

  • isUnicast()
  • isMulticast()
  • isUniversal()
  • isLocal()

要求

  • PHP >= 8.1

安装

通过Composer

$ composer require option/mac

使用方法

use Option\Mac\Mac;

// Any format will do; only hex digits is considered
$mac = Mac::factory("1234.5678.90AB");

// Output in various formats:
echo $mac;             // 01:23:45:67:89:AB
echo $mac->asColon();  // 01:23:45:67:89:AB
echo $mac->asDot();    // 0123.4567.89AB
echo $mac->asIEE802(); // 01-23-45-67-89-AB
echo $mac->asDash();   // 01-23-45-67-89-AB

// Keep the OUI but zero out the NIC.
echo $mac->vendor();   // 01-23-45-00-00-00

许可证

GNU Lesser General Public License (LGPL-3.0-or-later)。请参阅许可证文件获取更多信息。