Execute from bash:

cd htdocs/
curl -sS https://getcomposer.org/installer | php
emacs composer.json

Edit composer.json so that it contains:

# cat composer.json
    "require": {
        "geoip2/geoip2": "0.6.*"


php composer.phar install

Get the Maxmind free geoip database:

cd /path/to/yourphpfile
wget http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz -O GeoLite2-City.mmdb.gz
gunzip GeoLite2-City.mmdb.gz
ln -s GeoLite2-City.mmdb GeoIP2-City.mmdb

Now you can use the simple example provided at maxmind, or the one I have created: https://github.com/droidzone/geoip