PHPackages                             kentjerone/fluent-activity-logger - 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. kentjerone/fluent-activity-logger

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

kentjerone/fluent-activity-logger
=================================

A fluent activity logger for models

v1.0.1(8mo ago)02MITPHPPHP ^8.2CI passing

Since Sep 30Pushed 8mo agoCompare

[ Source](https://github.com/ramosramosramos/fluent-activity-logger)[ Packagist](https://packagist.org/packages/kentjerone/fluent-activity-logger)[ RSS](/packages/kentjerone-fluent-activity-logger/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (6)Versions (3)Used By (0)

---

Laravel Activity Logger
=======================

[](#laravel-activity-logger)

An activity logger for Eloquent models.

---

Installation
------------

[](#installation)

Install via Composer:

```
composer require kentjerone/laravel-activity-logger
```

Publish the config and migrations:

```
php artisan vendor:publish --tag="activity-logger-config"
php artisan vendor:publish --tag="activity-logger-migrations"
```

Run the migrations:

```
php artisan migrate
```

This will publish:

- `config/activitylogger.php` → package configuration
- `database/migrations/xxxx_xx_xx_xxxxxx_create_activity_logs_table.php` → migration file

---

Configuration
-------------

[](#configuration)

Inside `config/activitylogger.php` you can configure:

```
declare(strict_types=1);

return [

    'table_name' => (string) env('ACTIVITY_LOGGER_TABLE', 'activity_logs'),

    'model_events' => (array) [

        'created' => true,
        'updated' => true,
        'deleted' => true,

        'restored' => false,
        'forceDeleted' => false,

        'creating' => false,
        'updating' => false,
        'deleting' => false,

    ],

    'request_payload' => [
        'except' => [
            'password',
            'password_confirmation',
            'remember_token',
        ],
    ],

];
```

---

In Model
--------

[](#in-model)

To enable automatic logging for a model:

```
use KentJerone\ActivityLogger\Models\Concerns\HasAuthActivityLogger;

class User extends Authenticatable
{
   use HasAuthActivityLogger;
}
```

---

Usage
-----

[](#usage)

> **Note:** If you don’t pass a model (`made_by_model`), the logger will automatically use the currently authenticated user (`auth()->user()`).

```
// Example 1: Quick log without passing a model (defaults to auth()->user())
createActivityLog(
    human_message: 'Profile updated'
);

// Example 2: Quick log with a model
$user = \App\Models\User::factory()->create()->fresh();

createActivityLog(
    made_by_model:$user,
    human_message: 'User registered',
    human_extra_message: ['email' => $user->email]
);

// Example 3: Using the CreateActivityLog action directly
$user = \App\Models\User::factory()->create()->fresh();

createActivityLog()->handle(
    made_by_model:$user,
    human_message: 'User created via factory',
    developer_message: 'POST /register',
    developer_extra_message: ['ip' => request()->ip()],
    application_extra_message: ['debug' => 'custom app info']
);
```

---

Fluent Activity Builder
-----------------------

[](#fluent-activity-builder)

You can also use the `activity()` helper for a clean, chainable syntax:

```
// Minimal log
activity()
    ->humanMessage('User updated profile')
    ->create();

// With model and extra messages
$user = \App\Models\User::factory()->create()->fresh();

activity()
    ->madeByModel($user)
    ->humanMessage('User registered')
    ->humanExtraMessage(['email' => $user->email])
    ->developerMessage('POST /register')
    ->developerExtraMessage(['ip' => request()->ip()])
    ->applicationExtraMessage(['debug' => 'custom app info'])
    ->create();
```

---

Which Style to Use?
-------------------

[](#which-style-to-use)

StyleExampleWhen to Use**Quick helper**`activityLog($user, human_message: 'User registered')`Simple one-liner logs.**Action**`createActivityLog()->handle($user, ...)`When you need full control and explicit arguments.**Builder**`Activity::make()->humanMessage(...)->create()`When building logs step by step.**Helper Builder**`activity()->humanMessage(...)->create()`Cleanest, most expressive way for everyday use.---

Human vs Developer Messages
---------------------------

[](#human-vs-developer-messages)

- **human\_message / human\_extra\_message** → Intended for business or end-user context (e.g., *"User updated their profile"*)
- **developer\_message / developer\_extra\_message** → Intended for debugging, HTTP request details, or developer insight (e.g., *"PATCH /users/1"*)
- **application\_message / application\_extra\_message** → Automatic or extra system-level context (IP, user agent, URL, old/new changes, etc.)

---

Getting the Log Activities
--------------------------

[](#getting-the-log-activities)

```
activityLog()->all();
```

You can also query directly via the model:

```
use KentJerone\ActivityLogger\ActivityLog;

$logs = ActivityLog::latest()->take(10)->get();
```

---

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

---

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance59

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~11 days

Total

2

Last Release

264d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/167238174?v=4)[Kent Jerone Ramos](/maintainers/ramosramosramos)[@ramosramosramos](https://github.com/ramosramosramos)

---

Top Contributors

[![ramosramosramos](https://avatars.githubusercontent.com/u/167238174?v=4)](https://github.com/ramosramosramos "ramosramosramos (47 commits)")

---

Tags

laravelfluentloggeractivity logger

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/kentjerone-fluent-activity-logger/health.svg)

```
[![Health](https://phpackages.com/badges/kentjerone-fluent-activity-logger/health.svg)](https://phpackages.com/packages/kentjerone-fluent-activity-logger)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M165](/packages/spatie-laravel-health)[ytake/laravel-aspect

Aspect Oriented Programming library for laravel framework, and lumen

138141.3k1](/packages/ytake-laravel-aspect)[spatie/laravel-flare

Send Laravel errors to Flare

111.4M7](/packages/spatie-laravel-flare)

PHPackages © 2026

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