GeoIP2 PHP API v2.4.4
  • Namespace
  • Class

Namespaces

  • GeoIp2
    • Database
    • Exception
    • Model
    • Record
    • WebService
  • MaxMind
    • Db
      • Reader
  • PHP

Classes

  • Reader

Class Reader

Instances of this class provide a reader for the MaxMind DB format. IP addresses can be looked up using the

get

method.

Namespace: MaxMind\Db
Located at MaxMind/Db/Reader.php

Methods summary

public
# __construct( string $database )

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.

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.

Parameters

$database
the MaxMind DB file to use.

Throws

InvalidArgumentException
for invalid database path or unknown arguments
MaxMind\Db\Reader\InvalidDatabaseException

if the database is invalid or there is an error reading from it.

public array
# get( string $ipAddress )

Looks up the

address

in the MaxMind DB.

Looks up the

address

in the MaxMind DB.

Parameters

$ipAddress
the IP address to look up.

Returns

array
the record for the IP address.

Throws

BadMethodCallException
if this method is called on a closed database.
InvalidArgumentException
if something other than a single IP address is passed to the method.
MaxMind\Db\Reader\InvalidDatabaseException

if the database is invalid or there is an error reading from it.

public MaxMind\Db\Reader\Metadata
# metadata( )

Returns

MaxMind\Db\Reader\Metadata
object for the database.

Throws

InvalidArgumentException
if arguments are passed to the method.
BadMethodCallException
if the database has been closed.
public
# close( )

Closes the MaxMind DB and returns resources to the system.

Closes the MaxMind DB and returns resources to the system.

Throws

Exception
if an I/O error occurs.
GeoIP2 PHP API v2.4.4 API documentation generated by ApiGen