rpodwika/network-calculator
Composer 安装命令:
composer require rpodwika/network-calculator
包简介
Tools to calculate network subnet, prefix, mask, IP range in PHP
README 文档
README
#Network calculator in PHP
During searching for good network calculator I couldn't find a good one written in PHP. That's why I've decided to write it using only bitmask operations and math.
#What can I calculate?
- Network address
- Broadcast address
- CIDR prefix
- First and last IP in the network
- Number of possible hosts in the network
#How to use?
$networkCalculator = new NetworkCalculator("192.168.1.14, "255.255.255.0");
echo $networkCalculator->calculateNetworkAddress(); // 192.168.1.0
echo $networkCalculator->calculateBroadcastIp(); // 192.168.1.255
echo $networkCalculator->calculateNetworkMaskLength(); // 24
list($first, $last) = $networkCalculator->calculateIpRange();
echo $first; // 192.168.1.1
echo $last; // 192.168.1.254
echo $networkCalculator; // will print all the information in pretty way
#Found a bug?
Just make pull request or report issue
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-06-25