najibismail/multigeoip

从多个GeoIP提供商获取IP地址信息

v1.0.9 2021-12-22 03:07 UTC

This package is auto-updated.

Last update: 2024-09-29 06:08:59 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

从多个提供商获取IP地址信息

要求

  • PHP: ^7.0
  • Laravel: ~6.0,~7.0,~8.0

安装

通过以下命令使用composer进行安装

composer require najibismail/multigeoip

发布配置文件

php artisan multigeoip:publish

下载免费Maxmind DB

php artisan multigeoip:maxmind-db

用法

外观

use Najibismail\MultiGeoip\Facades\Multigeoip;

// Auto get an IP Address
$ip_info = Multigeoip::ip();

// [OR]

// Set the IP Address
$ip_info = Multigeoip::ip('{IP ADDRESS}');

// Get the IP Address details
$ip_info->all(); 
$ip_info->getIp();
$ip_info->getCountryCode();
$ip_info->getCountry();
$ip_info->getCity();
$ip_info->getZipCode();
$ip_info->getState();
$ip_info->getTimezone();

辅助工具

// Auto get an IP Address
$ip_info = multigeoip();

// [OR]

// Set the IP Address
$ip_info = multigeoip('{IP ADDRESS}');

// Get the IP Address details
$ip_info->all(); 
$ip_info->getIp();
$ip_info->getCountryCode();
$ip_info->getCountry();
$ip_info->getCity();
$ip_info->getZipCode();
$ip_info->getState();
$ip_info->getTimezone();

免责声明

MultiGeoIP使用了MaxMind的GeoLite数据库。使用MultiGeoIP服务并利用地理位置数据需接受Creative Commons Attribution-ShareAlike 3.0 Unported License。在所有提及此数据库功能或使用的广告和文档中,需要包含以下声明以符合归因要求:

This product includes GeoLite data created by MaxMind, available from
<a href="http://www.maxmind.com">http://www.maxmind.com</a>.

许可证

MIT许可证(MIT)。请参阅许可证文件以获取更多信息。