承接 maurokouti/php-geoip-shim 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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): string
  • geoip_continent_code_by_name(string $hostname): string
  • geoip_country_code_by_name(string $hostname): string
  • geoip_country_name_by_name(string $hostname): string
  • geoip_database_info(int $database = GEOIP_COUNTRY_EDITION): string
  • geoip_db_avail(int $database): bool
  • geoip_db_filename(int $database): string
  • geoip_db_get_all_info(): array
  • geoip_domain_by_name(string $hostname): string
  • geoip_isp_by_name(string $hostname): string
  • geoip_netspeedcell_by_name(string $hostname): string
  • geoip_org_by_name(string $hostname): string
  • geoip_record_by_name(string $hostname): array
  • geoip_region_by_name(string $hostname): array

License

MIT

统计信息

  • 总下载量: 322
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-08-26