NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #1506 most downloaded on Packagist
Handle IPv4, IPv6 addresses and ranges
Latest stable
1.22.1
Last release 2 months ago
17 Sep 2026
Ships unpredictably
gaps range from 3 weeks to 2.8 years
Nearly every release is documented
notes for 27 of 28 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
28 releases · first in 2016
Drag across the ruler to compare, or tap a release to open it.
Update versions of GitHub Actions by @mlocati in https://github.com/mlocati/ip-lib/pull/112
Full Changelog: https://github.com/mlocati/ip-lib/compare/1.22.0...1.22.1
Full Changelog: 1.22.0...1.22.1
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Add PHPStan checks by @mlocati in https://github.com/mlocati/ip-lib/pull/108
Full Changelog: https://github.com/mlocati/ip-lib/compare/1.21.0...1.22.0
Full Changelog: 1.21.0...1.22.0
Minor fix in IPv6::add() by @mlocati in https://github.com/mlocati/ip-lib/pull/97
Full Changelog: https://github.com/mlocati/ip-lib/compare/1.20.0...1.21.0
Full Changelog: 1.20.0...1.21.0
Add AddressInterface::shift() by @mlocati in https://github.com/mlocati/ip-lib/pull/94
Full Changelog: https://github.com/mlocati/ip-lib/compare/1.19.0...1.20.0
Full Changelog: 1.19.0...1.20.0
Add split method to IP ranges (#93, @alissn @mlocati)
split method to IP ranges (#93, @alissn @mlocati)getNetworkPrefix is now available for all implementations of IP ranges (#93, @mlocati)Full Changelog: https://github.com/mlocati/ip-lib/compare/1.18.1...1.19.0
split method to IP ranges (#93, @alissn @mlocati)getNetworkPrefix is now available for all implementations of IP ranges (#93, @mlocati)Full Changelog: 1.18.1...1.19.0
Avoid PHP 8.4 deprecation warnings by @mlocati in https://github.com/mlocati/ip-lib/pull/91
Full Changelog: https://github.com/mlocati/ip-lib/compare/1.18.0...1.18.1
Ability to parse addresses in ARPA (Reverse DNS Lookup) format
Fix Range\Single::containsRange() method
In order to support parsing the above notations, some new functions have been introduced, which deprecate some of the methods that parse strings.
In order to support parsing the above notations, some new functions have been introduced, which deprecate some of the methods that parse strings.
| Deprecated function | New function |
|---|---|
IPLib\Factory::addressFromString |
IPLib\Factory::parseAddressString |
IPLib\Factory::rangeFromString |
IPLib\Factory::parseRangeString |
IPLib\Factory::rangeFromBoundaries |
IPLib\Factory::getRangeFromBoundaries |
IPLib\Factory::rangesFromBoundaries |
IPLib\Factory::getRangesFromBoundaries |
IPLib\Address\IPv4::fromString |
IPLib\Address\IPv4::parseString |
IPLib\Address\IPv6::fromString |
IPLib\Address\IPv6::parseString |
IPLib\Range\Pattern::fromString |
IPLib\Range\Pattern::parseString |
IPLib\Range\Single::fromString |
IPLib\Range\Single::parseString |
IPLib\Range\Subnet::fromString |
IPLib\Range\Subnet::parseString |
See the phpdoc of the deprecated methods for further details.
Special thanks to @elrido for his productive contributions.
New method for ranges: getSize() (thanks @vstelmakh)
getSize() (thanks @vstelmakh)Fix typo in RangesFromBoundaryCalculator class (thanks @lucascherifi)
RangesFromBoundaryCalculator class (thanks @lucascherifi)getAddressAtOffset() (thanks @ernix)rangesFromBoundaries() (thanks @crucifyer)New methods added to IPLib\Address\AddressInterface:
IPLib\Address\AddressInterface:
getNumberOfBits()getBits()IPLib\Factory:
rangesFromBoundaries()New methods added to IPLib\Range\RangeInterface:
IPLib\Range\RangeInterface:
asSubnet()asPattern()getReverseDNSLookupName()New getReverseDNSLookupName() method added to AddressInterface: you can use it to perform reverse DNS lookups
getReverseDNSLookupName() method added to AddressInterface: you can use it to perform reverse DNS lookupsImprove support for IPv4 to IPv6 and IPv6 to IPv4 conversions (see README.md)
Add support for non-decimal IPv4/range addresses (more details)
New method: IPLib\Address\IPv6::toMixedIPv6IPv4String() to render IPv6 addresses in the mixed IPv6+IPv4 representation described in https://tools.ietf
IPLib\Address\IPv6::toMixedIPv6IPv4String() to render IPv6 addresses in the mixed IPv6+IPv4 representation described in https://tools.ietf.org/html/rfc4291#section-2.2 point 3IPLib\Factory::addressFromString() can now parse the mixed IPv6+IPv4 representation (for example: 2001:da8:d800:9:200:5efe:101.94.1.77)New method: IPLib\Range\Pattern::asSubnet() to convert pattern ranges (eg 192.168.0.*) to subnet/CIDR ranges (eg `192.168.0.0/24)
IPLib\Range\Pattern::asSubnet() to convert pattern ranges (eg 192.168.0.*) to subnet/CIDR ranges (eg `192.168.0.0/24)IPLib\Range\Subnet::asPattern() to convert subnet/CIDR ranges (eg 192.168.0.0/24) to pattern ranges (eg 192.168.0.*)getSubnetMask()) to retrieve the subnet mask (only for IPv4 ranges)Add getNetworkPrefix method to IPLib\Range\Subnet class (thanks @tomsim).
Add getNetworkPrefix method to IPLib\Range\Subnet class (thanks @tomsim).
Add support for partial IPv4 pattern addresses (for example 127.0.* and 127.*).
Add support for partial IPv4 pattern addresses (for example 127.0.* and 127.*).
New instance methods available for IPLib\Range\RangeInterface:
New instance methods available for IPLib\Range\RangeInterface:
getRangeType()containsRange(RangeInterface $otherRange)New static methods available for IPLib\Range\AddressInterface:
getReservedRanges()getDefaultReservedRangeType()getReservedRanges()New static methods available for IPLib\Range\Subnet:
get6to4()6to4 subnet rangeNew methods available for IPLib\Address\AddressInterface:
IPLib\Address\AddressInterface:
getNextAddress()getPreviousAddress()IPLib\Range\RangeInterface:
getStartAddress()getEndAddress()Added support to IPv6 zone ids (see RFC 4007).
Added support to IPv6 zone ids (see RFC 4007).
Remove TravisCI-specific files from the distribution archive
Remove TravisCI-specific files from the distribution archive
New method available: \IPLib\Factory::rangeFromBoundaries()
New method available: \IPLib\Factory::rangeFromBoundaries()
Fix long representation of IPv4 addresses (thanks @henry-spanka !) See https://github.com/mlocati/ip-lib/pull/3
Added support to IPv4-Mapped IPv6 Address (see RFC 4291 §2.5.5.2) (example: :127.0.0.1)
::ffff:127.0.0.1)127.0.0.1:80 and [::1]:80)Nothing published for this version
One column per quarter.