Download the PHP package bis-gmbh/ip-addr without Composer
On this page you can find all versions of the php package bis-gmbh/ip-addr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package ip-addr
IP-Addr library manages IPv4 and IPv6 addresses and subnets
Installation
Install with composer:
Installation requirements
- PHP version 5.4 or above
- PHP GMP extension for IPv6 arbitrary arithmetic
Abstract usage example
Will output:
Used by
API
Constructor
:small_blue_diamond: v4::create | v6::create
Description
Parameters
- anyFormat
- integer, e.g.
123
,0xABCDEF00
,075227
,0b0101010
- numeric string, e.g.
'123'
,'0xABCDEF00'
,'075227'
,'0b0101010'
- textual format:
- v4,
'192.168.10.1'
,'172.16.3'
,'10.0'
- v6,
'a:b:c:d::'
,'::'
,'::345d:10.40.60.1'
- CIDR format:
- v4,
'10.0.0.0/8'
,'192.168/16'
- v6,
'2000:b:c:d::/64'
,'::1/128'
- range format
'<first_addr> - <second_addr>'
, where<first_addr>
and<second_addr>
- addresses in textual format with the same ip version - v4
'10.0.0.0 - 10.0.0.255'
- v6
'2000:b:c:d::5d - 2000:b:c:d::ff'
- integer, e.g.
- maskString network mask in textual format, allow if anyFormat parameter also in textual format
- v4
'255.255.255.0'
,'255.0'
- v6
'ffff:ffff:ffff:ffff::'
- v4
Return values
Returns a Address
object on success
Examples
:small_blue_diamond: new v4 | new v6
Description
Creates a Address
instances by new operator with the same parameters as the method create
.
Examples
Class
Methods
:small_blue_diamond: v4::isNumeric | v6::isNumeric
Description
Checks if the parameter value present in numeric format.
Parameters
- value - verified value
Return values
Returns TRUE if the value in numeric format, and FALSE if not.
Examples
:small_blue_diamond: v4::isTextual | v6::isTextual
Description
Checks if the parameter value present in textual format.
Parameters
- value - verified value
Return values
Returns TRUE if the value in textual format, and FALSE if not.
:small_blue_diamond: v4::isCIDR | v6::isCIDR
Description
Checks if the parameter value present in CIDR format.
Parameters
- value - verified value
Return values
Returns TRUE if the value in CIDR format, and FALSE if not.
:small_blue_diamond: v4::isRange | v6::isRange
Description
Checks if the parameter value present in range format. Allows any order of addresses - direct or reverse, e.g. '10.0.0.255 - 10.0.0.0'
is allowed range.
Parameters
- value - verified value
Return values
Returns TRUE if the value in range format, and FALSE if not.
Examples
Instance
Properties
:small_orange_diamond: v4::$privateNetworks
Description
Array of private v4 networks as described in rfc1918.
:small_orange_diamond: v4::$multicastNetworks
Description
Array of multicast v4 networks as described in rfc3171.
:small_orange_diamond: v4::$reservedNetworks
Description
Array of reserved v4 networks as described in RFC 1112, Section 4.
:small_orange_diamond: v4::$networkTypes
Description
Array of associative arrays representing special-purpose v4 addresses with their descriptions, rfc5735.
:small_orange_diamond: v6::$addressTypes
Description
Array of associative arrays representing v6 address types with their descriptions, rfc4291.
Methods
:small_blue_diamond: v4::version | v6::version
Description
Return values
Returns the version number of the address of the current object.
Examples
:small_blue_diamond: v4::assign | v6::assign
Description
Assigns new address and mask values for the current object.
Parameters
See create method.
Examples
:small_blue_diamond: v4::binary | v6::binary
TODO
:small_blue_diamond: v4::decimal | v6::decimal
TODO
:small_blue_diamond: v4::hexadecimal | v6::hexadecimal
TODO
:small_blue_diamond: v4::netmask | v6::netmask
TODO
:small_blue_diamond: v4::prefixLength | v6::prefixLength
TODO
:small_blue_diamond: v4::first | v6::first
TODO
:small_blue_diamond: v4::last | v6::last
TODO
:small_blue_diamond: v4::numAddrs | v6::numAddrs
TODO
:small_blue_diamond: v4::numHosts | v6::numHosts
TODO
:small_blue_diamond: v4::hostBits | v6::hostBits
TODO
:small_blue_diamond: v4::within | v6::within
TODO
:small_blue_diamond: v4::contains | v6::contains
TODO
:small_blue_diamond: v4::addr | v6::addr
TODO
:small_blue_diamond: v4::mask | v6::mask
TODO
:small_blue_diamond: v4::cidr | v6::cidr
TODO
:small_blue_diamond: v4::range | v6::range
TODO
:small_blue_diamond: v4::reverse | v6::reverse
TODO
:small_blue_diamond: v4::reverseMask | v6::reverseMask
TODO
:small_blue_diamond: v4::netType | v6::netType
TODO
:small_blue_diamond: v4::network
TODO
:small_blue_diamond: v4::broadcast
TODO
:small_blue_diamond: v4::netClass
TODO
:small_blue_diamond: v6::full
TODO
:small_blue_diamond: v6::full4
TODO
:small_blue_diamond: v6::fullMask
TODO
:small_blue_diamond: v6::compressed
TODO
:small_blue_diamond: v6::compressed4
TODO
Array access
TODO
Iterators
Address iteration
TODO
Host iteration
TODO
Subnet iteration
TODO
Exceptions
Static methods and methods of objects can throw exceptions of the following types:
\InvalidArgumentException
when calling a method with incorrect arguments;\DomainException
when trying to use language constructs that do not apply to address objects, for example, overwriting an element when accessing an array by index key;\RuntimeException
when the library classes can not work in the current environment, for example, PHP GMP extension not installed.
Utils Class
Methods
:small_blue_diamond: make
Description
Trying to create an object of any of the versions based on the provided arguments
Parameters
See create method.
Return values
Returns a Address
object on success
Examples
:small_blue_diamond: info
Description
Parameters
addr - v4
or v6
object
Return values
Returns the array with summary information about given address.
Examples
All versions of ip-addr with dependencies
ext-gmp Version >=5.4