mrmystic/cakephp-geoip-plugin

CakePHP plugin for MaxMind GeoIP

dev-master 2015-04-02 12:43 UTC

This package is auto-updated.

Last update: 2024-05-29 03:06:43 UTC


README

CakePHP GeoIP Plugin

A CakePHP Plugin for finding a location based on an IP Address using the MaxMind GeoIP database and the PEAR Net_GeoIP package.

SEE ALSO
------------

http://www.maxmind.com/app/ip-location
http://pear.php.net/package/Net_GeoIP/
http://pear.php.net/manual/en/package.networking.net-geoip.lookuplocation.php

INSTALLATION
------------

1. Copy the plugin to app/Plugin/GeoIp
2. Add <code>CakePlugin::load('GeoIp');</code> to <code>bootstrap.php</code>
3. Download the MaxMind GeoLite City Database at http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
4. Uncompress the database to app/Plugin/GeoIp/data/GeoIP.dat

USAGE
---------------

```php
    App::uses('GeoIpLocation', 'GeoIp.Model');
    $GeoIpLocation = new GeoIpLocation();
    $ipAddr = CakeRequest::clientIp(false);
    $location = $GeoIpLocation->find($ipAddr);
```