admiral / geoip
此包已被废弃且不再维护。没有建议的替代包。
CakePHP GeoIP插件
1.0.0
2021-02-23 13:29 UTC
Requires
- php: >=7.0
- cakephp/cakephp: >=3.6
- geoip2/geoip2: ~2.0
Suggests
- ext-maxminddb: An optional C extenstion that can dramatically increase the performance on lookups in the databases.
This package is auto-updated.
Last update: 2024-09-05 19:14:49 UTC
README
Admiral插件,通过MaxMind GeoIP2数据库获取GeoIP数据
入门指南
首先,使用Composer安装插件
composer require admiral/geoip
接下来,将插件加载到您的Application.php
class Application extends BaseApplication {
public function bootstrap() {
parent::bootstrap();
// Load the GeoIP plugin
$this->addPlugin('Admiral/GeoIP');
}
}
向您的config/app.php
添加一些配置
'GeoIP' => [
'license' => 'YOUR_LICENSE_KEY',
'dir' => TMP, // Or the directory you desire
],
下载所需的数据库
bin/cake geoip download --asn --city --country
加载数据库
use Admiral\GeoIP\Database;
$asnDb = new Database('GeoLite2-ASN.mmdb')->getReader();
之后,它将与MaxMind库提供相同的服务。
版本兼容性
以下是一个版本兼容性表。
请注意,当发布新版本时,维护者对旧版本的支持将立即终止。 | 插件版本 | CakePHP版本 | |----------------|-----------------| | 1.x | >=3.6 |