A zend framework 2 module for geolocation.
-
This module is available on Packagist. In your project's
composer.json
use:{ "require": { "php": ">=5.3.3", "zendframework/zendframework": "*", "geolocation/freegeoip": "dev-master" }
-
Or clone this project into your
./vendor/
directory.
Usage:
-
In the controller
$geoloc = $this->getServiceLocator()->get('Geolocation\Service\Geolocation'); $geoloc->setIp( $ip); $result = $geoloc->getLocation();