You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've followed the steps to integrate the librairy in my project.
I've created a Service to use it in my code like so:
// src/Service/GeoipLib.php
namespace App\Services;
use GeoIp2\Database\Reader;
class GeoIPLib
{
private $reader;
public function __construct(Reader $reader)
{
$this->reader = $reader;
}
public function getCity($ip)
{
// get a GeoIP2 City model
$record = $this->reader->city($ip);
return $record->mostSpecificSubdivision->name;
}
public function getCountry($ip)
{
// get a GeoIP2 City model
$record = $this->reader->city($ip);
return $record->country->isoCode;
}
public function getPostalCode($ip)
{
// get a GeoIP2 City model
$record = $this->reader->city($ip);
return $record->postal->code;
}
}
and my config file is as follow:
# Read the README file for more detailed configuration information
# https://github.com/gpslab/geoip2
gpslab_geoip:
# You should specify your personal licence key
license: 'XXXXX'
# Edition ID of database you need
edition: 'GeoLite2-City'
url: 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=XXXXX&suffix=tar.gz'
If I follow the url, it does download the file so the key seems good to me.
However, when I'm trying to use the librairy, I'm getting the following error message:
The file var/cache/dev/GeoLite2-City.mmdb does not exist or is not readable
Indeed, it does not exist in the cache folder.
Please help.
Thank you.
The text was updated successfully, but these errors were encountered:
Hi there,
I've followed the steps to integrate the librairy in my project.
I've created a Service to use it in my code like so:
and my config file is as follow:
If I follow the url, it does download the file so the key seems good to me.
However, when I'm trying to use the librairy, I'm getting the following error message:
Indeed, it does not exist in the cache folder.
Please help.
Thank you.
The text was updated successfully, but these errors were encountered: