ocolin/maclookup
最新稳定版本:3.6
Composer 安装命令:
composer require ocolin/maclookup
包简介
Basic tool to look up vendor of a MAC address
README 文档
README
This was an experimental project to look for different ways to look up MAC address vendors for other tools. Now that some people are using it I will try to be mindful of not breaking it while experimenting.
Currently trying 3 methods to see which works best and will likely end up with options to use any of them. The methods I am trying are:
- Streaming the vendor content from a text file for low memory usage.
- Loading all vendor content into memory to increase speed up lookups.
- Loading from a database to see how it compares memory and speed wise.
!!! Version 4 will not be compatible with this one. !!!
Example results:
FILE LOOKUP Memory used: 0.03 MB Time: 0.0022971153259277 MEMORY LOOKUP Memory used: 17.67 MB Time: 0.0010538339614868 DB LOOKUP Memory used: 0.02 MB Time: 0.00094333489735921
To not interfere with the first implementation which is streaming from file I have made two new classes for the other methods. I will likely make a version 4 which will incorporate them all into one call since that will not be compatible with this current setup.
Installation
composer require ocolin/maclookup
Requirements
PDO - Which should come built in to PHP. PHP 8.2 or higher.
Instantiation
Using the MacLookup class does not need instantiation and is a completely static. However the memory and DB classes need instantiation for efficiency.
Example
$lookup = Ocolin\MacLookup\MacMem();
$lookup = Ocolin\MacLookup\MacDB();
These will load what is needed and download the vendor content if missing and before being used.
Models
DB version MacDB
$maclookup = Ocolin\MacLookup\MacDB(); $vendor = $lookup->lookup( mac: '54:91:AF:B2:02:3A' );
Example output:
Ocolin\MacLookup\Row Object
(
[registry] => MA-L
[assignment] => 302303
[name] => Belkin International Inc.
[address] => 12045 East Waterfront Drive Playa Vista null US 90094
)
Memory version MacMem
$maclookup = Ocolin\MacLookup\MacMem(); $vendor = $lookup->lookup( mac: '54:91:AF:B2:02:3A' );
File version MacLookup
$vendor = MacLookup::lookup( mac: '54:91:AF:B2:02:3A' );
Updating vendor list.
All three versions have an update() function. However the DB version needs to be instantiated to use the database.
Example:
// FILE $status = Ocolin\MacLookup\MacLookup::update(); // MEMORY $status = Ocolin\MacLookup\MacMem::update(); // DB $status = Ocolin\MacLookup::update();
统计信息
- 总下载量: 1.88k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-08