trrtly/ip2region

hyperf ip2region

v0.0.2 2022-05-07 19:06 UTC

This package is auto-updated.

Last update: 2022-06-07 19:16:10 UTC


README

针对 hyperf 的 ip2region 组件,采用速度最快的 memorySearch 方式查询,在框架初始化时就将db文件载入内存

安装

composer require trrtly/ip2region

示例

use Trrtly\Ip2region\Ip2region;
use Hyperf\Di\Annotation\Inject;

class Example
{
    /**
     * @Inject
     * @var Ip2region
     */
    protected $ip2region;

    public function query()
    {
        $address = $this->ip2region->memorySearch($ip);
        var_dump($address);
    }
}