Yer is a PHP geolocation library.
Install it via composer eabay/yer
<?php
require_once __DIR__.'/vendor/autoload.php';
$geolocation = new Yer\Geolocation;
$geolocation->setLocator(new Yer\Locator\GeobytesLocator());
var_dump($geolocation->lookup('193.140.215.133'));You can turn ssl on/off:
<?php
...
$geolocation->setLocator(new Yer\Locator\GeobytesLocator(true));If you have a paid subscription,
<?php
...
$geolocation->setLocator(new Yer\Locator\GeobytesLocator(true /* or false */, 'your email', 'your password'));<?php
...
$geolocation->setLocator(new Yer\Locator\MaxMindWebServiceLocator('your license key'));You can use your custom locator providers by implementing Yer\Locator\LocatorInterface.
You can validate IP address before query to the locator provider
<?php
...
$geolocation->setIpValidator(new Yer\Validator\IpValidator())If you want to use your own validator implement Yer\Validator\ValidatorInterface