Download the PHP package gpslab/geoip2 without Composer
On this page you can find all versions of the php package gpslab/geoip2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gpslab/geoip2
More information about gpslab/geoip2
Files in gpslab/geoip2
Package geoip2
Short Description A Symfony Bundle for the Maxmind GeoIP2 API
License MIT
Homepage https://github.com/gpslab/geoip2
Informations about the package geoip2
A Symfony Bundle for the Maxmind GeoIP2 API
Bundle for use maxmind/GeoIP2 in Symfony.
Installation
Pretty simple with Composer, run:
Configuration
To configure auto-update the database you need to generate your personal licence key.
Steps for generate licence key
- Sign up for a MaxMind account (no purchase required)
- Login and generate a licence key
- Save your licence key
- Open download page and find your needed DB edition
ID
and copy value from first column.
Example configuration:
Database source URL
By default, this URL is used to download a new databases
https://download.maxmind.com/app/geoip_download?edition_id={edition_id}&license_key={license_key}&suffix=tar.gz
edition_id
- character ID name from first column on download page;license_key
- your personal licence key.
You can change this URL, for example, if you want to use a proxy to download the database. You can customize the source URL in the configuration.
Target download path
By default, new databases downloaded in %kernel.cache_dir%/{edition_id}.mmdb
, where edition_id
is a character ID
name from first column on download page. That is, by default, the new
database will be downloaded into folder var/cache/{env}/
. Keeping the database in the cache folder for each
environment may not be optimal. You can choose a common directory for all environments.
Localization
By default, the English locale is used for GeoIP record. You can change the locale for record and declare multiple locales for fallback.
Usage
You can get GeoIP2 reader service:
For more example see the GeoIP2 library.
Multiple databases
You can use multiple GeoIP databases in one application. Need update configuration file.
Using in application:
You can rename the default database.
In order not to repeat the license key and locales for each database, you can specify them once.
GeoIP data in client locale
If you want to show the GeoIP data to the user and show them in the user locale, then you can use the reader factory.
Console commands
Update GeoIP database
Execute console command for update all databases:
If you use multiple databases, then for config:
You can update several databases:
Optionally installing splitbrain/php-archive uses significantly less memory when updating a database and can avoid out of memory errors:
Download GeoIP database
You can download custom database with console command:
License
This bundle is under the MIT license. See the complete license in the file: LICENSE
All versions of geoip2 with dependencies
ext-zlib Version *
php Version >=7.2.0
geoip2/geoip2 Version ~2.0|~3.0
symfony/http-kernel Version ~2.8|~3.0|~4.0|~5.0|~6.0|~7.0
symfony/dependency-injection Version ~2.8|~3.0|~4.0|~5.0|~6.0|~7.0
symfony/expression-language Version ~2.8|~3.0|~4.0|~5.0|~6.0|~7.0
symfony/config Version ~2.8|~3.0|~4.0|~5.0|~6.0|~7.0
symfony/console Version ~2.8|~3.0|~4.0|~5.0|~6.0|~7.0
symfony/filesystem Version ~2.8|~3.0|~4.0|~5.0|~6.0|~7.0