Closed henri9813 closed 4 years ago
This bundle only registers services of maxmind/GeoIP2-php. If maxmind/GeoIP2-php supports ASN (i think it does), then you can use it with this bundle.
You can try with this config:
gpslab_geoip:
cache: '%kernel.cache_dir%/GeoLite2-ASN.mmdb'
url: 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN.tar.gz'
Yes it support it,
So, i can't read multiple mmdb files ?
So, i can't read multiple mmdb files ?
Yes. Currently, the bundle does not allow working simultaneously with several database files.
You can independently register a separate service for ASN database.
services:
geoip2.reader.asn:
class: GeoIp2\Database\Reader
arguments: [ '%kernel.cache_dir%/GeoLite2-ASN.mmdb', '%geoip2.locales%' ]
public: true
And you can update it with command:
bin/console geoip2:update "https://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN.tar.gz" "path/to/cache/dir/GeoLite2-ASN.mmdb"
Okay,
Thanks for your reply ! :+1: :1st_place_medal:
Now you can use multiple GeoIP databases in one application. Need update configuration file.
gpslab_geoip:
databases:
default:
license: 'XXXXXXXXXXXXXXXX'
edition: 'GeoLite2-City'
asn:
license: 'XXXXXXXXXXXXXXXX'
edition: 'GeoLite2-ASN'
Using in application:
// get a GeoIP2 reader for City database
$default_reader = $this->get('geoip2.database.default_reader');
// or
//$default_reader = $this->get(Reader::class);
// or
//$default_reader = $this->get('geoip2.reader');
// get a GeoIP2 reader for ASN database
$asn_reader = $this->get('geoip2.database.asn_reader');
See README file for more detals.
Hello,
How can i use ASN database with your bundle ?
Best regards