-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow use multi databases #31
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…n without file loader
# Conflicts: # composer.json # src/Command/UpdateDatabaseCommand.php # src/DependencyInjection/GpsLabGeoIP2Extension.php
2 similar comments
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #8
BC breack change
Renamed configuration option
cache
topath
.Before
After
How to use
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
, whereedition_id
is a character ID name from first column on download page. That is, by default, the new database will be downloaded into foldervar/cache/{env}/
. Keeping the database in the cache folder for eachenvironment 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.
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:
Download GeoIP database
You can download custom database with console command: