2017 © Pedro PelĂĄez
 

symfony-bundle geoip

MaxMind GeoIP Symfony2 Bundle

image

maxmind/geoip

MaxMind GeoIP Symfony2 Bundle

  • Thursday, February 8, 2018
  • by idciconsulting
  • Repository
  • 5 Watchers
  • 24 Stars
  • 509,792 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 36 Forks
  • 0 Open issues
  • 16 Versions
  • 5 % Grown

The README.md

Maxmind GeoIp Library

Symfony bundle to easily use maxmind geoip bundle., (*1)

SensioLabsInsight Build, (*2)

Installation

To install this library please follow the next steps:, (*3)

First add the dependencie to your composer.json file:, (*4)

"require": {
    ...
    "maxmind/geoip": "dev-master"
},

Then install the bundle with the command:, (*5)

php composer update

Enable the bundle in your application kernel:, (*6)

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Maxmind\Bundle\GeoipBundle\MaxmindGeoipBundle(),
    );
}

Now the library is installed., (*7)

To get the maxmind data source file (in '.dat' format), you can choose between one of the two following purposed methods:, (*8)

You can go on the maxmind free download data page: http://dev.maxmind.com/geoip/geolite And get the needed version. Then you have to unzip the downloaded file in the data directory located in 'vendor/maxmind/geoip/data'., (*9)

Or you can simply execute this command:, (*10)

php app/console maxmind:geoip:update-data %url-data-source%

Replace %url-data-source% with the url of the needed data source. ex: http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz, (*11)

If you want to use your data file in another directory, you can configure it on app\config\config.yml, (*12)

# app/config/config.yml
maxmind_geoip:
    data_file_path: "%kernel.root_dir%/../web/GeoIPCity.dat"

Now can use the Maxmind GeoIp Library everywhere in your Symfony2 application., (*13)

Usage

The following examples are available if you are in a controller, (*14)

$geoip = $this->get('maxmind.geoip')->lookup(%IP_ADDR%);

$geoip->getCountryCode();
$geoip->getCountryCode3();
$geoip->getCountryName();
$geoip->getRegion();
$geoip->getCity();
$geoip->getPostalCode();
$geoip->getLatitude();
$geoip->getLongitude();
$geoip->getAreaCode();
$geoip->getMetroCode();
$geoip->getContinentCode();

Or in twig file, (*15)

{{ ip|geoip.countryCode }}
{{ ip|geoip.countryCode3 }}
{{ ip|geoip.countryName }}
{{ ip|geoip.regionCode }}
{{ ip|geoip.region }}
{{ ip|geoip.city }}
{{ ip|geoip.postalCode }}
{{ ip|geoip.latitude }}
{{ ip|geoip.longitude }}
{{ ip|geoip.areaCode }}
{{ ip|geoip.metroCode }}
{{ ip|geoip.continentCode }}

You can add a demo route in your 'routing_dev' to get an example on how this bundle work for example:, (*16)

_maxmind_geoip:
    resource: "@MaxmindGeoipBundle/Controller/DemoController.php"
    type:     annotation
    prefix:   /demo

Get a lookup at /demo/geoip, (*17)

This library is an import of Maxmind GeoIp Free Library, you can find at http://www.maxmind.com/, (*18)

The Versions

08/02 2018

1.0.x-dev

1.0.9999999.9999999-dev

MaxMind GeoIP Symfony2 Bundle

  Sources   Download

BSD-2-Clause BSD

The Requires

  • php >=5.3

 

by Sébastien Roch

maxmind geoip

08/02 2018

dev-master

9999999-dev

MaxMind GeoIP Symfony2 Bundle

  Sources   Download

BSD-2-Clause BSD

The Requires

 

The Development Requires

by Sébastien Roch

maxmind geoip

08/02 2018

1.1.x-dev

1.1.9999999.9999999-dev

MaxMind GeoIP Symfony2 Bundle

  Sources   Download

BSD-2-Clause BSD

The Requires

 

The Development Requires

by Sébastien Roch

maxmind geoip

08/02 2018

v1.1.5

1.1.5.0

MaxMind GeoIP Symfony2 Bundle

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

by Sébastien Roch

maxmind geoip

15/06 2017

dev-php-cs-fixer

dev-php-cs-fixer

MaxMind GeoIP Symfony2 Bundle

  Sources   Download

BSD

The Requires

 

The Development Requires

by Sébastien Roch

maxmind geoip

15/06 2017

dev-travis

dev-travis

MaxMind GeoIP Symfony2 Bundle

  Sources   Download

BSD

The Requires

 

The Development Requires

by Sébastien Roch

maxmind geoip

21/04 2017

dev-eluminae

dev-eluminae

MaxMind GeoIP Symfony2 Bundle

  Sources   Download

BSD

The Requires

  • php >=5.3

 

by Sébastien Roch

maxmind geoip

17/11 2016

dev-docstring

dev-docstring

MaxMind GeoIP Symfony2 Bundle

  Sources   Download

BSD

The Requires

  • php >=5.3

 

by Sébastien Roch

maxmind geoip

14/10 2016

v1.1.4

1.1.4.0

MaxMind GeoIP Symfony2 Bundle

  Sources   Download

BSD

The Requires

  • php >=5.3

 

by Sébastien Roch

maxmind geoip

08/08 2016

1.1.3

1.1.3.0

MaxMind GeoIP Symfony2 Bundle

  Sources   Download

BSD

The Requires

  • php >=5.3

 

by Sébastien Roch

maxmind geoip

03/08 2016

v1.1.2

1.1.2.0

MaxMind GeoIP Symfony2 Bundle

  Sources   Download

BSD

The Requires

  • php >=5.3

 

by Sébastien Roch

maxmind geoip

03/03 2016

v1.1.1

1.1.1.0

MaxMind GeoIP Symfony2 Bundle

  Sources   Download

BSD

The Requires

  • php >=5.3

 

by Sébastien Roch

maxmind geoip

18/02 2016

v1.1.0

1.1.0.0

MaxMind GeoIP Symfony2 Bundle

  Sources   Download

BSD

The Requires

  • php >=5.3

 

by Sébastien Roch

maxmind geoip

18/02 2016

v1.0.2

1.0.2.0

MaxMind GeoIP Symfony2 Bundle

  Sources   Download

BSD

The Requires

  • php >=5.3

 

by Sébastien Roch

maxmind geoip

06/01 2016

v1.0.1

1.0.1.0

MaxMind GeoIP Symfony2 Bundle

  Sources   Download

BSD

The Requires

  • php >=5.3

 

by Sébastien Roch

maxmind geoip

01/06 2015

1.0.0

1.0.0.0

MaxMind GeoIP Symfony2 Bundle

  Sources   Download

BSD

The Requires

  • php >=5.3

 

by Sébastien Roch

maxmind geoip