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
This is for everyone looking for a completely free database (as far as i can see also for commercial use) https://db-ip.com/db/download/ip-to-city-lite
Needs to be said: The city accuracy is not that good
Here is the corresponding service:
<?phpnamespaceApp\Services\GeoIP;
usePharData;
useException;
useGeoIp2\Database\Reader;
useTorann\GeoIP\Services\MaxMindDatabase;
classDBIPextends MaxMindDatabase
{
/** * Update function for service. * * @return string * @throws Exception */publicfunctionupdate()
{
if ($this->config('database_path', false) === false) {
thrownewException('Database path not set in config file.');
}
$this->withTemporaryDirectory(function ($directory) {
$gzFile = sprintf('%s/dbip-city-lite.gz', $directory);
file_put_contents($gzFile, fopen($this->config('update_url'), 'r'));
$file = gzopen($gzFile, 'rb');
$outFile = fopen($this->config('database_path'), 'wb');
while (!gzeof($file)) fwrite($outFile, gzread($file, 4096));
fclose($outFile);
gzclose($file);
});
return"Database file ({$this->config('database_path')}) updated.";
}
}
This is for everyone looking for a completely free database (as far as i can see also for commercial use)
https://db-ip.com/db/download/ip-to-city-lite
Needs to be said: The city accuracy is not that good
Here is the corresponding service:
and the config:
The text was updated successfully, but these errors were encountered: