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)16MITBladePHP ^8.1

Since Apr 21Pushed 1y 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

28

—

LowBetter than 52% of packages

Maintenance47

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

438d 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

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M95](/packages/mongodb-laravel-mongodb)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M130](/packages/roots-acorn)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M130](/packages/laravel-pulse)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[masterro/laravel-mail-viewer

Easily view in browser outgoing emails.

65108.9k](/packages/masterro-laravel-mail-viewer)

PHPackages © 2026

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