bodakyuriy / ipstorage
IP 存储
dev-develop
2018-10-16 10:13 UTC
Requires
- php: >=7.0
Requires (Dev)
- phpunit/phpunit: ^7
This package is not auto-updated.
Last update: 2024-09-26 01:30:33 UTC
README
一个用于存储 IP 地址的小型灵活库。
安装
通过 Composer
$ composer require bodakyuriy/ipstorage:dev-develop
文档
ipstorage 客户端的基本用法
use IPStorage\IPStorage; use IPStorage\Drivers\PDODriver\Driver\PDODriver; //Create instance of IPStorage $ipStorage = new IPStorage(); //Create instance of storage driver from box PDODriver $storageDriver = new PDODriver('sqlite:ip_store.sqlite3'); /** * Set storage driver to IPStore which it will use for stored ip addresses. * You can set your drivers which implements StorageDriverInterface */ $ipStorage->driver($storageDriver); //Store IP address and return count of stored $ipStorage->add('127.0.0.1'); //Return count of stored $ipStorage->getCount('127.0.0.1');
可选的 ipstorage 客户端用法
use IPStorage\IPStorage; use IPStorage\Drivers\PDODriver\Driver\PDODriver; //Create instance of IPStorage $ipStorage = new IPStorage(); /** * Library use default ip validator but you can replace it your own validator which implemens ValidatorInteraface */ $ipStorage->validator($validator);
许可证
MIT 许可证 (MIT)。请参阅 许可证文件 获取更多信息。