PHP
The Javascript library of the API.

Requirements

  • php: >=7.4

Installation

1
composer require gre/geoip
Copied!

Importing the library

1
include_once './vendor/autoload.php';
2
3
// Using the library
4
use GRE\GeoIP\GeoIP;
5
6
// Declaring the library's class
7
$GREGeoIP = new GeoIP();
Copied!
The $GREGeoIP variable will be used to call the API methods and functions.

Setting the API Key

Before we can use the methods of this library we have to set our API Key. This can be done by calling the setKey function:
1
$GREGeoIP->setKey('<API-Key>');
Copied!
DO NOT forget to change the <API-Key> with your own API Key. If you don't have one, please take a look at the Quick Start page.

Methods & Usage

After importing and defining the package you're ready now to use all it's functionalities. The library is consist or 2 main methods.