Reader
in package
Instances of this class provide a reader for the MaxMind DB format. IP addresses can be looked up using the get method.
Table of Contents
- __construct() : mixed
- Constructs a Reader for the MaxMind DB format. The file passed to it must be a valid MaxMind DB file such as a GeoIp2 database file.
- close() : void
- Closes the MaxMind DB and returns resources to the system.
- get() : mixed
- Retrieves the record for the IP address.
- getWithPrefixLen() : array<string|int, mixed>
- Retrieves the record for the IP address and its associated network prefix length.
- metadata() : Metadata
Methods
__construct()
Constructs a Reader for the MaxMind DB format. The file passed to it must be a valid MaxMind DB file such as a GeoIp2 database file.
public
__construct(string $database) : mixed
Parameters
- $database : string
-
the MaxMind DB file to use
Tags
Return values
mixed —close()
Closes the MaxMind DB and returns resources to the system.
public
close() : void
Tags
Return values
void —get()
Retrieves the record for the IP address.
public
get(string $ipAddress) : mixed
Parameters
- $ipAddress : string
-
the IP address to look up
Tags
Return values
mixed —the record for the IP address
getWithPrefixLen()
Retrieves the record for the IP address and its associated network prefix length.
public
getWithPrefixLen(string $ipAddress) : array<string|int, mixed>
Parameters
- $ipAddress : string
-
the IP address to look up
Tags
Return values
array<string|int, mixed> —an array where the first element is the record and the second the network prefix length for the record
metadata()
public
metadata() : Metadata
Tags
Return values
Metadata —object for the database