maurokouti/php-geoip-shim
Composer 安装命令:
composer require maurokouti/php-geoip-shim
包简介
PHP GeoIP shim to support legacy geoip_* functions with the GeoIP2 .mmdb database files.
README 文档
README
As MaxMind retires GeoIP Legacy databases
in May 2022 and the fact that geoip PHP extension is not supported in PHP 8.0
this library might be useful as a quickfix for the projects with legacy codebase.
Install via Composer
composer require maurokouti/php-geoip-shim
Usage
<?php \GeoIPShim\GeoIp2::init([ '/var/lib/GeoIP/GeoIP2-Country.mmdb', '/var/lib/GeoIP/GeoIP2-ISP.mmdb', ]); // by IP address $ipAddress = '1.2.3.4'; $countryCode = geoip_country_code_by_name($ipAddress); $ispName = geoip_isp_by_name($ipAddress); // by hostname $hostname = 'github.com'; $countryCode = geoip_country_code_by_name($hostname); $ispName = geoip_isp_by_name($hostname);
Supported functions
geoip_asnum_by_name(string $hostname): stringgeoip_continent_code_by_name(string $hostname): stringgeoip_country_code_by_name(string $hostname): stringgeoip_country_name_by_name(string $hostname): stringgeoip_database_info(int $database = GEOIP_COUNTRY_EDITION): stringgeoip_db_avail(int $database): boolgeoip_db_filename(int $database): stringgeoip_db_get_all_info(): arraygeoip_domain_by_name(string $hostname): stringgeoip_isp_by_name(string $hostname): stringgeoip_netspeedcell_by_name(string $hostname): stringgeoip_org_by_name(string $hostname): stringgeoip_record_by_name(string $hostname): arraygeoip_region_by_name(string $hostname): array
License
统计信息
- 总下载量: 322
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-08-26