Blesta Source Documentation

GeoIp2 extends AbstractGeoIp

GeoIP v2 integration

Table of Contents

Properties

$reader
$records

Methods

__construct() Create a new GeoIP instance using the given database file
getCountryCode() Returns the 2-character country code where the IP resides
getCountryName() Returns the name of the country where the IP resides
getIp() Returns the currently set IP address
getLocation() Fetches an array of information about the location of the IP address, including longitude and latitude.
getOrganization() Would get the organization or ISP that owns the current IP address. However this information is not available from the GeoIp2 city model
getRegion() Get the region (e.g. state) of the given IP address.
setIp() Sets the Ip address to use for all suybsequent queries
Properties

$reader

private Reader $reader

The GeoIP2 database reader to use for querying to database

$records

private array<string|int, mixed> $records = []

An array of records retrieved from the database keyed by IP addresses

Methods

__construct()

Create a new GeoIP instance using the given database file

public __construct(string $database_file) : mixed
Parameters
$database_file : string

The full path to the database file

getCountryCode()

Returns the 2-character country code where the IP resides

public getCountryCode() : string
Return values
string

The 2-character country code where the IP resides

getCountryName()

Returns the name of the country where the IP resides

public getCountryName() : string
Return values
string

The name of the country where the IP resides

getIp()

Returns the currently set IP address

public getIp() : string
Return values
string

The IP given in $ip, or the user's IP if $ip was null.

getLocation()

Fetches an array of information about the location of the IP address, including longitude and latitude.

public getLocation() : array<string|int, mixed>
Return values
array<string|int, mixed>

An array of information about the location of the IP address

getOrganization()

Would get the organization or ISP that owns the current IP address. However this information is not available from the GeoIp2 city model

public getOrganization() : string
Return values
string

getRegion()

Get the region (e.g. state) of the given IP address.

public getRegion() : string
Return values
string

The region the IP address resides in

setIp()

Sets the Ip address to use for all suybsequent queries

public setIp(string $ip) : mixed
Parameters
$ip : string

The Ip address to set

Tags
subpackage

core.Util.GeoIp

copyright

Copyright (c) 2019, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results