Lines Matching refs:address

44 ### Parse an address
46 To parse an IPv4 address:
49 $address = \IPLib\Address\IPv4::fromString('127.0.0.1');
52 To parse an IPv6 address:
55 $address = \IPLib\Address\IPv6::fromString('::1');
58 To parse an address in any format (IPv4 or IPv6):
61 $address = \IPLib\Factory::addressFromString('::1');
62 $address = \IPLib\Factory::addressFromString('127.0.0.1');
69 $address = \IPLib\Factory::addressFromString('::1');
70 echo (string) $address->getPreviousAddress();
72 echo (string) $address->getNextAddress();
77 ### Parse an IP address range
164 ### Check if an address is contained in a range
166 …a `contains` method, and all the IP address types offer a `matches` method: you can call them to c…
169 $address = \IPLib\Factory::addressFromString('1:2:3:4:5:6:7:8');
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…
182 All the range types offer a `containsRange` method: you can call them to check if an address range …
191 ### Getting the type of an IP address
193 If you want to know if an address is within a private network, or if it's a public IP, or whatever …
196 $address = \IPLib\Factory::addressFromString('::');
198 $typeID = $address->getRangeType();
204 - `\IPLib\Range\Type::T_UNSPECIFIED` if the address is all zeros (`0.0.0.0` or `::`)
205 - `\IPLib\Range\Type::T_LOOPBACK` if the address is the localhost (usually `127.0.0.1` or `::1`)
206 - `\IPLib\Range\Type::T_PRIVATENETWORK` if the address is in the local network (for instance `192.1…
207 - `\IPLib\Range\Type::T_PUBLIC` if the address is for public usage (for instance `104.25.25.33` or …
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:
219 // 'Public address'
264 … package offers a great feature: you can store address ranges in a database table, and check if an…
266 To save a range, you need to store the address type (for IPv4 it's `4`, for IPv6 it's `6`), as well…
276address is within a stored range, simply use the `getComparableString` method of the address and c…
285 * - $address is an address object
299 // Retrieve the saved ranges where an address $address falls:
303 and :address between rangeFrom and rangeTo
306 ':addressType' => $address->getAddressType(),
307 ':address' => $address->getComparableString(),