Lines Matching refs:range

77 ### Parse an IP address range
79 To parse a subnet (CIDR) range:
82 $range = \IPLib\Range\Subnet::fromString('127.0.0.1/24');
83 $range = \IPLib\Range\Subnet::fromString('::1/128');
86 To parse a pattern (asterisk notation) range:
89 $range = \IPLib\Range\Pattern::fromString('127.0.0.*');
90 $range = \IPLib\Range\Pattern::fromString('::*');
93 To parse an andress as a range:
96 $range = \IPLib\Range\Single::fromString('127.0.0.1');
97 $range = \IPLib\Range\Single::fromString('::1');
100 To parse a range in any format:
103 $range = \IPLib\Factory::rangeFromString('127.0.0.*');
104 $range = \IPLib\Factory::rangeFromString('::1/128');
105 $range = \IPLib\Factory::rangeFromString('::');
109 ### Retrive a range from its boundaries
112 $range = \IPLib\Factory::rangeFromBoundaries('192.168.0.1', '192.168.255.255');
113 echo (string) $range;
118 ### Retrive the boundaries of a range
121 $range = \IPLib\Factory::rangeFromString('127.0.0.*');
122 echo (string) $range->getStartAddress();
124 echo (string) $range->getEndAddress();
164 ### Check if an address is contained in a range
166range types offer a `contains` method, and all the IP address types offer a `matches` method: you …
170 $range = \IPLib\Factory::rangeFromString('0:0::1/64');
172 $contained = $address->matches($range);
174 $contained = $range->contains($address);
177 Please remark that if the address is IPv4 and the range is IPv6 (or vice-versa), the result will al…
180 ### Check if a range contains another range
182 All the range types offer a `containsRange` method: you can call them to check if an address range
203 The most notable values of the range type ID are:
210 ### Getting the type of an IP address range
212 If you want to know the type of an address range, you can use the `getRangeType` method:
215 $range = \IPLib\Factory::rangeFromString('2000:0::1/64');
216 $type = $range->getRangeType();
222 Please remark that if a range spans across multiple range types, you'll get NULL as the range type:
225 $range = \IPLib\Factory::rangeFromString('::/127');
226 $type = $range->getRangeType();
266range, you need to store the address type (for IPv4 it's `4`, for IPv6 it's `6`), as well as two …
269 $range->getAddressType();
270 $range->getComparableStartString();
271 $range->getComparableEndString();
274 Let's assume that you saved the type in a field called `addressType`, and the range boundaries in t…
276 When you want to check if an address is within a stored range, simply use the `getComparableString`…
284 * - $range is a range object
288 // Save the $range object
294 ':addressType' => $range->getAddressType(),
295 ':rangeFrom' => $range->getComparableStartString(),
296 ':rangeTo' => $range->getComparableEndString(),