trrtly / ip2region
hyperf ip2region
Installs: 3 069
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- php: >=7.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- hyperf/testing: ~3.1.0
- mockery/mockery: ^1.0
- phpstan/phpstan: ^0.12
- phpunit/phpunit: >=7.0
- swoole/ide-helper: ^4.5
- swow/swow: dev-develop
- symfony/var-dumper: ^5.1
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); } }