PHPackages                             laravel-enso/actionlogger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. laravel-enso/actionlogger

Abandoned → [laravel-enso/action-logger](/?search=laravel-enso%2Faction-logger)Library[Logging &amp; Monitoring](/categories/logging)

laravel-enso/actionlogger
=========================

User actions logger dependency for Laravel Enso

3.8.2(1mo ago)1016.1k41MITPHP

Since Mar 20Pushed 1mo ago4 watchersCompare

[ Source](https://github.com/laravel-enso/action-logger)[ Packagist](https://packagist.org/packages/laravel-enso/actionlogger)[ Docs](https://github.com/laravel-enso/action-logger)[ RSS](/packages/laravel-enso-actionlogger/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (12)Versions (123)Used By (1)

Action Logger
=============

[](#action-logger)

[![License](https://camo.githubusercontent.com/b9a10bdda2da427453b6cde342bc0b1f49b40dd3db27d688730b106abf126678/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f616374696f6e2d6c6f676765722f6c6963656e7365)](LICENSE)[![Stable](https://camo.githubusercontent.com/e2e23e85b77d15ffd7498ffba9f0a913185e47ea8ba50bb2fe1ad92f8acc98b7/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f616374696f6e2d6c6f676765722f76657273696f6e)](https://packagist.org/packages/laravel-enso/action-logger)[![Downloads](https://camo.githubusercontent.com/17cedc24f6bc4c15e4a30da9bdb617f2f674f31057810f03c8a6919ff63c4c45/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f616374696f6e2d6c6f676765722f646f776e6c6f616473)](https://packagist.org/packages/laravel-enso/action-logger)[![PHP](https://camo.githubusercontent.com/da7cf113b588d26fe679dfefe4a15009272ed358ad4e786ad3c78b45faa61d69/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e322532422d3737376262342e737667)](composer.json)[![Issues](https://camo.githubusercontent.com/9ac2ea618cce8dc0a20a59eac67617487c40b8fa97ce854b0de6ddce89c8636f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6c61726176656c2d656e736f2f616374696f6e2d6c6f676765722e737667)](https://github.com/laravel-enso/action-logger/issues)[![Merge Requests](https://camo.githubusercontent.com/a04dd4c3e2000a28aec56102a519d65ec31110539fe08c94748fd9b6a73d46fc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f6c61726176656c2d656e736f2f616374696f6e2d6c6f676765722e737667)](https://github.com/laravel-enso/action-logger/pulls)

Description
-----------

[](#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
------------

[](#installation)

This package comes pre-installed in Laravel Enso distributions that require activity tracking.

For standalone package installation inside an Enso-based application:

```
composer require laravel-enso/action-logger
```

The package auto-registers its service provider, loads its migrations, and registers the `action-logger` middleware alias.

Run the migrations after installation:

```
php artisan migrate
```

Features
--------

[](#features)

- Registers the `action-logger` route middleware alias.
- Creates and maintains the `action_logs` table through package migrations.
- Persists one log entry per authenticated request handled by the middleware.
- Stores `user_id`, `url`, `route`, numeric `method`, `duration`, and timestamps for each action.
- Exposes REST methods through the frontend-ready `Methods` enum.
- Adds a dynamic `actionLogs()` relationship to the Enso `User` model.
- Exposes an `ActionLog` model with `user()` and `permission()` relationships.
- Links logged route names back to Enso permissions through the `permission()` relation.
- Provides the `System > Action Logs` table 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
-----

[](#usage)

Apply the middleware to the routes you want to track:

```
Route::middleware(['web', 'auth', 'action-logger'])
    ->group(function (): void {
        Route::get('/administration/users/{user}', UserController::class)
            ->name('administration.users.show');
    });
```

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:

```
$logs = $user->actionLogs()
    ->latest()
    ->get();
```

API
---

[](#api)

### Middleware

[](#middleware)

- Alias: `action-logger`
- Class: `LaravelEnso\ActionLogger\Http\Middleware\ActionLogger`
- Behavior: creates the log entry in `terminate()`, after the response is sent

### Model

[](#model)

`LaravelEnso\ActionLogger\Models\ActionLog`

Stored attributes:

- `user_id`
- `url`
- `route`
- `method`
- `duration`
- `created_at`
- `updated_at`

`method` is cast to `LaravelEnso\ActionLogger\Enums\Methods`.

Relationships:

- `user()`Belongs to `LaravelEnso\Users\Models\User`
- `permission()`Belongs to `LaravelEnso\Permissions\Models\Permission` using `route -> name`

### Dynamic User Relation

[](#dynamic-user-relation)

The package binds an `actionLogs()` relation to `LaravelEnso\Users\Models\User` through the Enso dynamic-methods package.

### Enum

[](#enum)

`LaravelEnso\ActionLogger\Enums\Methods`

Registered frontend key:

- `actionLogMethods`

Supported methods:

- `GET`
- `POST`
- `PUT`
- `PATCH`
- `DELETE`
- `OPTIONS`
- `HEAD`

Use `Methods::fromRequest($request)` to map an internal Laravel request to the stored enum value.

### Table

[](#table)

Backend route group:

- Prefix: `api/system/actionLogs`
- Route names: `system.actionLogs.*`

Available endpoints:

- `system.actionLogs.initTable`
- `system.actionLogs.tableData`
- `system.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
----------

[](#depends-on)

Required Enso packages:

- [`laravel-enso/core`](https://docs.laravel-enso.com/backend/core.html) [↗](https://github.com/laravel-enso/core)
- [`laravel-enso/dynamic-methods`](https://docs.laravel-enso.com/backend/dynamic-methods.html) [↗](https://github.com/laravel-enso/dynamic-methods)
- [`laravel-enso/enums`](https://docs.laravel-enso.com/backend/enums.html) [↗](https://github.com/laravel-enso/enums)
- [`laravel-enso/menus`](https://docs.laravel-enso.com/backend/menus.html) [↗](https://github.com/laravel-enso/menus)
- [`laravel-enso/migrator`](https://docs.laravel-enso.com/backend/migrator.html) [↗](https://github.com/laravel-enso/migrator)
- [`laravel-enso/permissions`](https://docs.laravel-enso.com/backend/permissions.html) [↗](https://github.com/laravel-enso/permissions)
- [`laravel-enso/tables`](https://docs.laravel-enso.com/backend/tables.html) [↗](https://github.com/laravel-enso/tables)
- [`laravel-enso/upgrade`](https://docs.laravel-enso.com/backend/upgrade.html) [↗](https://github.com/laravel-enso/upgrade)
- [`laravel-enso/users`](https://docs.laravel-enso.com/backend/users.html) [↗](https://github.com/laravel-enso/users)

Framework dependency:

- Laravel 12 compatible application stack

Contributions
-------------

[](#contributions)

are welcome. Pull requests are great, but issues are good too.

Thank you to all the people who already contributed to Enso!

###  Health Score

59

—

FairBetter than 98% of packages

Maintenance89

Actively maintained with recent releases

Popularity31

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 72.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~31 days

Recently: every ~0 days

Total

109

Last Release

53d ago

Major Versions

1.3.0 → 2.0.02017-09-26

1.3.1 → 2.0.82018-03-05

2.4.2 → 3.0.02020-06-30

PHP version history (2 changes)1.0.0PHP &gt;=5.6.4

1.1.10PHP &gt;=7.1.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16073274?v=4)[Adrian Ocneanu](/maintainers/aocneanu)[@aocneanu](https://github.com/aocneanu)

---

Top Contributors

[![aocneanu](https://avatars.githubusercontent.com/u/16073274?v=4)](https://github.com/aocneanu "aocneanu (140 commits)")[![gandesc](https://avatars.githubusercontent.com/u/14071925?v=4)](https://github.com/gandesc "gandesc (23 commits)")[![vmcvlad](https://avatars.githubusercontent.com/u/37445394?v=4)](https://github.com/vmcvlad "vmcvlad (16 commits)")[![raftx24](https://avatars.githubusercontent.com/u/10864136?v=4)](https://github.com/raftx24 "raftx24 (7 commits)")[![AbdullahiAbdulkabir](https://avatars.githubusercontent.com/u/33360580?v=4)](https://github.com/AbdullahiAbdulkabir "AbdullahiAbdulkabir (5 commits)")[![GITmanuela](https://avatars.githubusercontent.com/u/44998004?v=4)](https://github.com/GITmanuela "GITmanuela (2 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

action-loggerlaravellaravel-ensolaravel-packagemiddlewarelogginglaravel-ensoaction-logger

### Embed Badge

![Health badge](/badges/laravel-enso-actionlogger/health.svg)

```
[![Health](https://phpackages.com/badges/laravel-enso-actionlogger/health.svg)](https://phpackages.com/packages/laravel-enso-actionlogger)
```

###  Alternatives

[laravel-enso/core

The backend shell of a Laravel Enso application

3465.3k206](/packages/laravel-enso-core)[laravel-enso/roles

Role management for Laravel Enso

1044.9k32](/packages/laravel-enso-roles)[laravel-enso/permissions

Permission management for Laravel Enso

1244.2k52](/packages/laravel-enso-permissions)[laravel-enso/action-logger

User actions logger dependency for Laravel Enso

1044.0k9](/packages/laravel-enso-action-logger)[laravel-enso/localisation

Language and translation management for Laravel Enso

1362.8k11](/packages/laravel-enso-localisation)[laravel-enso/tutorials

Tutorial management backend for Laravel Enso

1140.7k](/packages/laravel-enso-tutorials)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
