php-extended / php-ip-object
library that implements the php-extended/php-ip-interface interface library.
Requires
- php: >=8.0
- php-extended/php-ip-interface: ^7
- php-extended/php-parser-lexer: ^7
Requires (Dev)
- dev-master
- 7.0.6
- 7.0.5
- 7.0.4
- 7.0.3
- 7.0.2
- 7.0.1
- 7.0.0
- 6.0.7
- 6.0.6
- 6.0.5
- 6.0.4
- 6.0.3
- 6.0.2
- 6.0.1
- 6.0.0
- 5.0.1
- 5.0.0
- 4.5.2
- 4.5.1
- 4.5.0
- 4.4.7
- 4.4.6
- 4.4.5
- 4.4.4
- 4.4.3
- 4.4.2
- 4.4.1
- 4.4.0
- 4.3.2
- 4.3.1
- 4.3.0
- 4.2.12
- 4.2.11
- 4.2.10
- 4.2.9
- 4.2.8
- 4.2.7
- 4.2.6
- 4.2.5
- 4.2.4
- 4.2.3
- 4.2.2
- 4.2.1
- 4.2.0
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.3
- 4.0.2
- 4.0.1
- 4.0.0
- 3.1.0
- 3.0.2
- 3.0.1
- 3.0.0
- 2.0.1
- 2.0.0
This package is auto-updated.
Last update: 2024-10-31 00:17:55 UTC
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.phar
from their website. - Then run the following command to install this library as dependency :
php composer.phar php-extended/php-ip-object ^7
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).