Download the PHP package detain/iptools without Composer
On this page you can find all versions of the php package detain/iptools. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package iptools
IPTools
PHP Library for manipulating network addresses (IPv4 and IPv6).
Changes since fork
- 100% Code Coverage!
- Now Testing On PHP v5.6, v7.0, v7.1, v7.2, v7.3, and v7.4
- Added CodeClimate Coverage Reporting
- Added containsAny and containsAll to Range class for dealing with an array of IP/Range/Networks instead of a single one
- Added excludeArray to the Network class for dealing with an array of IP/Range/Networks to exclude instead of the single one with the existing exclude method
Installation
Composer: Run in command line:
or put in composer.json:
Usage
This library breaks its handling down into IP, Range, and Network types and provdes a matching named class to make working with all things IP much simpler.
IP Operations
Parsing IP from integer, binary and hex:
or:
Converting IP to other formats:
Other public properties:
maxPrefixLength
The max number of bits in the address representation: 32 for IPv4, 128 for IPv6.
octetsCount
The count of octets in IP address: 4 for IPv4, 16 for IPv6
reversePointer
The name of the reverse DNS PTR for the address:
Network Operations
Exclude IP from Network:
192.0.0.0/9
192.128.0.0/11
192.160.0.0/13
192.168.0.0/24
192.168.1.0/32
192.168.1.2/31
...
192.192.0.0/10
Exclude Subnet from Network:
192.0.0.0/9
192.128.0.0/11
192.160.0.0/13
192.168.0.0/24
192.168.2.0/23
...
192.192.0.0/10
Exclude Many Subnets from Network:
192.0.0.0/9
192.128.0.0/11
192.160.0.0/13
192.168.0.0/24
192.168.3.0/23
...
192.192.0.0/10
Split network into equal subnets
192.168.0.0/24
192.168.1.0/24
192.168.2.0/24
192.168.3.0/24
Iterate over Network IP adresses:
192.168.1.0
...
192.168.1.255
Get Network hosts adresses as Range:
192.168.1.1
...
192.168.1.254
Count Network IP adresses
Range Operations
Define the range in different formats:
Check if IP is within Range:
Check if IP is within any of the Ranges in an array:
Check if IP is within all of the Ranges in an array:
Iterate over Range IP adresses:
192.168.1.1
...
192.168.1.254
Get Networks that fit into a specified range of IP Adresses:
192.168.1.1/32
192.168.1.2/31
192.168.1.4/30
192.168.1.8/29
192.168.1.16/28
192.168.1.32/27
192.168.1.64/26
192.168.1.128/26
192.168.1.192/27
192.168.1.224/28
192.168.1.240/29
192.168.1.248/30
192.168.1.252/31
192.168.1.254/32
Count IP adresses in Range
License
The library is released under the MIT.
All versions of iptools with dependencies
ext-bcmath Version *