cmdrsharp/ip-addressing
Composer 安装命令:
composer require cmdrsharp/ip-addressing
包简介
A collection of traits for IP Operations.
README 文档
README
A collection of traits for general IP operations. New traits may be added over time.
Current Requirements
- PHP 7.1 or newer
Installation
Via composer
$ composer require cmdrsharp/ip-addressing
Usage
Use the applicable Trait in your classes.
use CmdrSharp\IpAddressing\IPv4; use CmdrSharp\IpAddressing\Subnet; class RandomClass { use IPv4, Subnet; protected function randomFunction() { $result = $this->getNetworkFromIp('192.168.0.55', '255.255.255.0'); // 192.168.0.0 $result = $this->getBroadcastFromIp('192.168.0.55', '255.255.255.0'); // 192.168.0.255 $result = $this->getCidrFromNetmask('255.255.255.0'); // 24 } }
What trait contains what?
IPv4
getNetworkFromIp(string $ip, string $netmask): stringgetBroadcastFromIp(string $ip, string $netmask): string
Subnet
getCidrFromNetmask(string $netmask): string
Versioning
This package follows Explicit Versioning.
Authors
License
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-08-21