dev-master
9999999-dev https://github.com/eabay/yerPHP Geolocation Library
MIT
The Requires
- php >=5.3.2
by Erhan Abay
geolocation maxmind geobytes
Wallogit.com
2017 © Pedro Peláez
PHP Geolocation Library
Yer is a PHP geolocation library., (*1)
Install it via composer eabay/yer, (*2)
Geobytes``` php <?php require_once DIR.'/vendor/autoload.php';, (*3)
$geolocation = new Yer\Geolocation; $geolocation->setLocator(new Yer\Locator\GeobytesLocator());, (*4)
var_dump($geolocation->lookup('193.140.215.133'));, (*5)
You can turn ssl on/off: ``` php <?php ... $geolocation->setLocator(new Yer\Locator\GeobytesLocator(true));
If you have a paid subscription, ``` php <?php ... $geolocation->setLocator(new Yer\Locator\GeobytesLocator(true /* or false */, 'your email', 'your password'));, (*6)
#### `MaxMind` ``` php <?php ... $geolocation->setLocator(new Yer\Locator\MaxMindWebServiceLocator('your license key'));
You can use your custom locator providers by implementing Yer\Locator\LocatorInterface., (*7)
You can validate IP address before query to the locator provider
php
<?php
...
$geolocation->setIpValidator(new Yer\Validator\IpValidator()), (*8)
If you want to use your own validator implement Yer\Validator\ValidatorInterface, (*9)
PHP Geolocation Library
MIT
geolocation maxmind geobytes