Download the PHP package huluti/geoip2-bundle without Composer
On this page you can find all versions of the php package huluti/geoip2-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download huluti/geoip2-bundle
More information about huluti/geoip2-bundle
Files in huluti/geoip2-bundle
Package geoip2-bundle
Short Description A Symfony Bundle for the Maxmind GeoIP2 API
License MIT
Homepage https://github.com/huluti/geoip2-bundle
Informations about the package geoip2-bundle
This is a fork of gpslab/geoip2, maintained for newer Symfony versions.
A Symfony Bundle for the Maxmind GeoIP2 API
Bundle to 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
IDand 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-bundle with dependencies
ext-zlib Version *
php Version >=8.1.0
geoip2/geoip2 Version ~3.0
symfony/http-kernel Version ^6.4|^7.3|^7.4|^8.0
symfony/dependency-injection Version ^6.4|^7.3|^7.4|^8.0
symfony/expression-language Version ^6.4|^7.3|^7.4|^8.0
symfony/config Version ^6.4|^7.3|^7.4|^8.0
symfony/console Version ^6.4|^7.3|^7.4|^8.0
symfony/filesystem Version ^6.4|^7.3|^7.4|^8.0