IPv4/IPv6 manipulation library for PHP inspired by Python ipaddress.
- PHP >= 5.2
- IPv6 support enabled
- GMP extension (www.php.net/manual/en/book.gmp.php)
- Download the single-file version
include
orrequire
it- Enjoy!
The recommended way is to install the lib through Composer.
Just add this to your composer.json
file (change the version by the release you want, or use dev-master
for the development version):
{
"require": {
"rlanvin/php-ip": "1.*"
}
}
Then run composer install
or composer update
.
Now you can use the autoloader, and you will have access to the library:
<?php
require 'vendor/autoload.php';
Caution: This library is compatible with PHP 5.2, therefore it is not namespaced.
Complete doc is available in the wiki.
Feel free to contribute! Just create a new issue or a new pull request.
I built this library for a project running PHP 5.2 (yep that's old). PHP 5.2 doesn't support late static binding, traits, namespaces and the like. So that explains some of the quirks of the design.
This library is released under the MIT License.