Download the PHP package laravel-enso/action-logger without Composer
On this page you can find all versions of the php package laravel-enso/action-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laravel-enso/action-logger
More information about laravel-enso/action-logger
Files in laravel-enso/action-logger
Package action-logger
Short Description User actions logger dependency for Laravel Enso
License MIT
Homepage https://github.com/laravel-enso/action-logger
Informations about the package action-logger
Action Logger
Description
Action Logger records authenticated user activity for routes that opt into Enso's action-logger middleware.
It is a small backend package focused on request auditing at the application edge. It captures which authenticated user accessed which named route, by which HTTP method, at what URL, and how long the request took to complete.
The package is designed to work inside the Laravel Enso ecosystem and integrates with Enso users, permissions, dynamic relationships, frontend enums, and Enso tables.
Installation
This package comes pre-installed in Laravel Enso distributions that require activity tracking.
For standalone package installation inside an Enso-based application:
The package auto-registers its service provider, loads its migrations, and registers the action-logger middleware alias.
Run the migrations after installation:
Features
- Registers the
action-loggerroute middleware alias. - Creates and maintains the
action_logstable through package migrations. - Persists one log entry per authenticated request handled by the middleware.
- Stores
user_id,url,route, numericmethod,duration, and timestamps for each action. - Exposes REST methods through the frontend-ready
Methodsenum. - Adds a dynamic
actionLogs()relationship to the EnsoUsermodel. - Exposes an
ActionLogmodel withuser()andpermission()relationships. - Links logged route names back to Enso permissions through the
permission()relation. - Provides the
System > Action Logstable structure, with user, method, permission, URL, duration and creation datetime columns. - Sorts the action logs table by newest entries first.
- Formats request duration as a numeric column with three decimal places.
- Keeps permissions as the route-facing table surface while the raw route value remains an internal storage detail.
Usage
Apply the middleware to the routes you want to track:
Once the middleware is active, every authenticated request matched by those routes will create a new action log entry when the request terminates.
The package also adds an actionLogs() relationship to the Enso user model, so user activity can be queried directly:
API
Middleware
- Alias:
action-logger - Class:
LaravelEnso\ActionLogger\Http\Middleware\ActionLogger - Behavior: creates the log entry in
terminate(), after the response is sent
Model
LaravelEnso\ActionLogger\Models\ActionLog
Stored attributes:
user_idurlroutemethoddurationcreated_atupdated_at
method is cast to LaravelEnso\ActionLogger\Enums\Methods.
Relationships:
user()Belongs toLaravelEnso\Users\Models\Userpermission()Belongs toLaravelEnso\Permissions\Models\Permissionusingroute -> name
Dynamic User Relation
The package binds an actionLogs() relation to LaravelEnso\Users\Models\User through the Enso dynamic-methods package.
Enum
LaravelEnso\ActionLogger\Enums\Methods
Registered frontend key:
actionLogMethods
Supported methods:
GETPOSTPUTPATCHDELETEOPTIONSHEAD
Use Methods::fromRequest($request) to map an internal Laravel request to the stored enum value.
Table
Backend route group:
- Prefix:
api/system/actionLogs - Route names:
system.actionLogs.*
Available endpoints:
system.actionLogs.initTablesystem.actionLogs.tableDatasystem.actionLogs.exportExcel
The companion frontend package is @enso-ui/action-logger.
The table defaults to action_logs.created_at desc, exposes created_at as a datetime column, and displays the resolved permission instead of a separate raw route column.
::: warning Note This package only logs actions for authenticated requests. If no authenticated user is available, no action log entry is created.
Because it relies on the resolved route name, routes without meaningful names provide less useful audit data. :::
Depends On
Required Enso packages:
laravel-enso/core↗laravel-enso/dynamic-methods↗laravel-enso/enums↗laravel-enso/menus↗laravel-enso/migrator↗laravel-enso/permissions↗laravel-enso/tables↗laravel-enso/upgrade↗laravel-enso/users↗
Framework dependency:
- Laravel 12 compatible application stack
Contributions
are welcome. Pull requests are great, but issues are good too.
Thank you to all the people who already contributed to Enso!
All versions of action-logger with dependencies
laravel-enso/dynamic-methods Version ^4.0
laravel-enso/enums Version ^3.0
laravel-enso/menus Version ^5.0
laravel-enso/migrator Version ^2.0
laravel-enso/permissions Version ^5.0
laravel-enso/tables Version ^5.0
laravel-enso/upgrade Version ^2.0
laravel-enso/users Version ^2.0