mostafaabdelbaset/laravel-ip-service

一个使用IP地址获取客户端国家的Laravel包。是http://ip2nation.com的一个封装。

2.0 2020-12-30 20:09 UTC

This package is auto-updated.

Last update: 2024-09-29 05:56:13 UTC


README

尝试猜测客户端的国籍代码,使用其IP地址。

安装

这里下载并导入来自ip2nation.com的IP数据库

用法

$service = App::make('Dimsav\IpService\IpService');


// country code for the given ip address

echo $service->getCountryCodeFromIp('123.123.123.123');


// country code for the client's ip address

echo $service->getCountryCodeFromClientIp();