PHPackages                             escarter/activity-log - 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. escarter/activity-log

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

escarter/activity-log
=====================

A Laravel package for logging user activity with admin and user views

1.0.1.0(1y ago)26MITBladePHP ^8.1

Since Apr 21Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/Escarter/activity-log)[ Packagist](https://packagist.org/packages/escarter/activity-log)[ RSS](/packages/escarter-activity-log/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (2)Used By (0)

Activity Log for Laravel
========================

[](#activity-log-for-laravel)

A comprehensive Laravel package for logging and tracking user activity in your application.

Features
--------

[](#features)

- Track model changes (create, update, delete)
- Log user login events
- View activity logs for specific users or models
- Admin dashboard for all activity logs
- User-specific activity log views
- Configurable retention period
- Bootstrap-styled components
- Livewire integration

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

[](#installation)

You can install the package via composer:

```
composer require escarter/activity-log
```

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

[](#configuration)

Publish the config file:

```
php artisan vendor:publish --tag=activity-log-config
```

Publish the migrations:

```
php artisan vendor:publish --tag=activity-log-migrations
```

Publish the views (optional):

```
php artisan vendor:publish --tag=activity-log-views
```

Run the migrations:

```
php artisan migrate
```

Usage
-----

[](#usage)

### Tracking model changes

[](#tracking-model-changes)

To track changes to a model, add the `LogsActivity` trait to the model:

```
use Escarter\ActivityLog\Traits\LogsActivity;
use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    use LogsActivity;

    // Optional: customize which events to log
    public function shouldLogActivity(string $event): bool
    {
        // Only log creates and updates
        return in_array($event, ['created', 'updated']);
    }
}
```

### Manual logging

[](#manual-logging)

You can manually log activities:

```
use Escarter\ActivityLog\ActivityLogFacade as ActivityLog;
use Escarter\ActivityLog\DTOs\ActivityLogData;

// Using facade
ActivityLog::log(new ActivityLogData(
    logName: 'orders',
    description: 'Order was shipped',
    subject: $order,
    causer: auth()->user(),
    event: 'shipped'
));

// Log model events
ActivityLog::logModel($model, 'archived', auth()->user());

// Log user login
ActivityLog::logLogin($user);
```

### Using the Activity Log views

[](#using-the-activity-log-views)

The package includes Livewire components for displaying activity logs:

1. Admin view (all logs):

```
// In your routes/web.php
Route::middleware(['auth', 'admin'])->group(function () {
    Route::get('/admin/activity-logs', function () {
        return view('activity-log::livewire.admin-activity-log');
    })->name('admin.activity-logs');
});
```

2. User view (user's own logs):

```
// In your routes/web.php
Route::middleware(['auth'])->group(function () {
    Route::get('/my-activity', function () {
        return view('activity-log::livewire.user-activity-log');
    })->name('user.activity-logs');
});
```

### Cleaning old logs

[](#cleaning-old-logs)

You can clean old logs using the provided command:

```
php artisan activity-log:clean --days=30
```

Or you can schedule it in your `App\Console\Kernel`:

```
protected function schedule(Schedule $schedule)
{
    $schedule->command('activity-log:clean')->daily();
}
```

License
-------

[](#license)

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

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance50

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

Unknown

Total

1

Last Release

392d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cceee8c6b0452354edcc2de2bfc370f108588f2320ccbd8ef8881499593d902c?d=identicon)[Escarter](/maintainers/Escarter)

---

Top Contributors

[![Escarter](https://avatars.githubusercontent.com/u/16120861?v=4)](https://github.com/Escarter "Escarter (13 commits)")

---

Tags

loglaravelactivityAuditlivewireuser activity

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/escarter-activity-log/health.svg)

```
[![Health](https://phpackages.com/badges/escarter-activity-log/health.svg)](https://phpackages.com/packages/escarter-activity-log)
```

###  Alternatives

[spatie/laravel-activitylog

A very simple activity logger to monitor the users of your website or application

5.8k45.4M309](/packages/spatie-laravel-activitylog)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[masterro/laravel-mail-viewer

Easily view in browser outgoing emails.

6392.1k](/packages/masterro-laravel-mail-viewer)[msonowal/laravel-auditor

A simple mongo activity logger to record various events of your laravel application

1030.2k1](/packages/msonowal-laravel-auditor)

PHPackages © 2026

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