zykutil / record-ip
To record IP info by customize type to DB.
1.0.0
2022-12-18 05:40 UTC
Requires
- php: ^8.0.2
- illuminate/database: ^9.43
- illuminate/support: ^9.0
- jenssegers/agent: ^2.6
Requires (Dev)
- illuminate/console: ^9.0
- illuminate/log: ^9.0
- mockery/mockery: ^1.4.4
- phpunit/phpunit: ^9.5.10
This package is auto-updated.
Last update: 2024-04-18 08:34:42 UTC
README
In order to create ip record.Depends on jenssegers/agent package.
Install
composer require zykutil/record-ip
config/app.php
providers add
ZYKUtil\RecordIp\RecordIpServiceProvider::class
alias add
'RecordIp' => ZYKUtil\RecordIp\RecordIpFacade::class
Copy the package config to your local config with the publish command:
php artisan vendor:publish --tag=zykutil-recordip --ansi --force
Depends on your setting in env file
RI_DB_CONNECTION=mysql
RI_DEFAULT_TABLE=system_request_ip_records
Migrate record table
php artisan ri:table
Create your own RecordType
use ZYKUtil\RecordIp\Factory\AbstractRecordIp;
class FooType extends AbstractRecordIp
{
public function __construct()
{
parent::__construct();
$this->type = 'foo';
}
}
Set Type in config file
'types' => [
'foo' => FooType::class
]
Simply used
\RecordIp::setActor('foo')->success("ask success");
\RecordIp::setActor('foo')->fail("ask fail");