php-extended/php-ip-object
最新稳定版本:8.0.10
Composer 安装命令:
composer require php-extended/php-ip-object
包简介
library that implements the php-extended/php-ip-interface interface library.
README 文档
README
A library that implements the php-extended/php-ip-interface interface library.
Installation
The installation of this library is made via composer and the autoloading of all classes of this library is made through their autoloader.
- Download
composer.pharfrom their website. - Then run the following command to install this library as dependency :
php composer.phar php-extended/php-ip-object ^8
Basic Usage
You may use this library this following way:
use PhpExtended\Ip\Ipv4;
$ipv4 = new Ipv4(255, 255, 255, 255);
The same process is usable with the Ipv6 class, for version 6 of IP
protocol. This library provides also network classes to be able to evaluate
if a specific ip address is within a network.
To parse ip addresses, do :
use PhpExtended\Ip\Ipv4AddressParser;
use PhpExtended\Ip\IpAddressParseException;
$parser = new Ipv4AddressParser();
try
{
$ipv4 = $parser->parse("255.255.255.0");
}
catch(IpAddressParseException $e)
{
// do something
}
The same process is usable with the Ipv6 class, for version 6 of IP
protocol. This library provides also network classes to be able to evaluate
if a specific ip address is within a network.
/!\ This library does not support embedded ipv4 in ipv6 addresses /!\
License
MIT (See license file).
统计信息
- 总下载量: 185.79k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 6
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-02-26