Class Reader
Instances of this class provide a reader for the GeoIP2 database format. IP
addresses can be looked up using the country
and city
methods. We also provide cityIspOrg
and omni
methods
to ease compatibility with the web service client, although we may offer the
ability to specify additional databases to replicate these web services in the
future (e.g., the ISP/Org database).
Usage
The basic API for this class is the same for every database. First, you create a reader object, specifying a file name. You then call the method corresponding to the specific database, passing it the IP address you want to look up.
If the request succeeds, the method call will return a model class for the
method you called. This model in turn contains multiple record classes, each of
which represents part of the data returned by the database. If the database does
not contain the requested information, the attributes on the record class will
have a null
value.
If the address is not in the database, an GeoIp2\Exception\AddressNotFoundException
exception will be thrown. If an
invalid IP address is passed to one of the methods, a SPL InvalidArgumentException
will be thrown. If the database is corrupt or
invalid, a \MaxMind\Db\Reader\InvalidDatabaseException will be
thrown.
- GeoIp2\Database\Reader implements GeoIp2\ProviderInterface
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
MaxMind\Db\Reader\Metadata
|
|
public
|