Download the PHP package lyrasoft/action-log without Composer
On this page you can find all versions of the php package lyrasoft/action-log. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package action-log
LYRASOFT Action Log Package
Installation
Install from composer
Then copy files to project
And run migrtions.
Next, add Middleware to routes/admin.route.php
If you want to log front and admin, you may put middleware to
main.route.php
Languages
Add this line to admin & front middleware to load language from package automatically:
If you want to copy language file to project, run this:
Register Admin Menu
Edit resources/menu/admin/sidemenu.menu.php
Getting Started
If you have setup ActionLog package, now try to save any item or filter any list, you can see a new log shows on
action_logs
table:
Auto Clear
Bt default, ActionLog only reserve last 3 months logs. It has 1/100 chance to trigger clear action.
You can configure the reserve time and clear chance at config file or using env to configure them:
Configure Middleware
Add options to middleware:
Config Name | Type | Default | Description |
---|---|---|---|
methods |
array, string, null | ['POST', 'PUT', 'PATCH', 'DELETE'] |
Allowed method, use NULL to allow all |
enabled |
bool | true |
Enabled log, you may add your env to configure this. |
max_time |
string, null | null |
Max reserve time, default using config and env, can be datetime string. |
clear_chance |
int, null | null |
Auto clear chance, default using config and env. |
clear_chance_base |
int, null | null |
Auto clear chance base, default using config and env. |
prepare_log |
callable, null | null |
The handler to handle log item, can be callable or closure, can inject services. |
Prepare Log Handler
Add a custom handler to configure every log, must use $log
argument to inject log item.
This is an example to override user name.
If you want to ignore some actions, just return FALSE in prepare log handler:
Manually Log
Just inject ActionLogService
to do this.
Custom Task (Action) and Entity Render
By default, the admin list table shows task and entity by english programaticlly name.
You can custom the render name by events. Create a subscriber:
Register this subscriber to etc/app/main.php
:
The text you return from event will show at table list:
All versions of action-log with dependencies
lyrasoft/luna Version ^2.1
lyrasoft/toolkit Version ^1.1
openspout/openspout Version ^4.22