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

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

rast/activity-log
=================

A simple activity log package that logs to file with model trait and log viewer UI

v1.3(6mo ago)018MITPHPPHP &gt;=8.0

Since Nov 21Pushed 6mo agoCompare

[ Source](https://github.com/raihanafroz/activitylog)[ Packagist](https://packagist.org/packages/rast/activity-log)[ RSS](/packages/rast-activity-log/feed)WikiDiscussions main Synced today

READMEChangelog (5)DependenciesVersions (6)Used By (0)

**RAST Activity Log**
=====================

[](#rast-activity-log)

A lightweight Laravel package for logging model activities (create, update, delete) **into log files** with a built-in viewer UI.

[![Issues](https://camo.githubusercontent.com/a5de3bb33288c069fad18f5d47c5786ed219aa064bca47e37892a3463a00896d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f72616968616e6166726f7a2f61637469766974796c6f673f7374796c653d666c61742d737175617265)](https://github.com/raihanafroz/activitylog/issues)[![Forks](https://camo.githubusercontent.com/3d4a2642d7a5016d598860df3e75f1fbbc0db0dd360d53af95a89732f5bcd896/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f72616968616e6166726f7a2f61637469766974796c6f673f7374796c653d666c61742d737175617265)](https://github.com/raihanafroz/activitylog/network/members)[![Stars](https://camo.githubusercontent.com/9569f20f1449a10655b6c85e22270c13b041a93f5df4d42ddf84ce9ad6db06bb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f72616968616e6166726f7a2f61637469766974796c6f673f7374796c653d666c61742d737175617265)](https://github.com/raihanafroz/activitylog/stargazers)[![Total Downloads](https://camo.githubusercontent.com/ed543eea29cfcddebdc8bd6525e16c14edfbdbb82ba840097a705f211d419835/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726173742f61637469766974792d6c6f673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rast/activity-log)
![Latest Version](https://camo.githubusercontent.com/e2367100cba06fb4b49ccbd7f8af46d40475360ed7a8848eb3865ba62c16ba65/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e302e302d626c75653f7374796c653d666f722d7468652d6261646765)![Laravel](https://camo.githubusercontent.com/286bc8408fc6d99ba34531349754ba683def127298353b4e4fa7dd2c36975f8b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31322b2d7265643f7374796c653d666f722d7468652d6261646765)![PHP](https://camo.githubusercontent.com/b02dfce6053dcb7606e65a65d28a655815504ffa4babebf48a05acf98c93b2ab/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e302b2d3737374242343f7374796c653d666f722d7468652d6261646765)![License](https://camo.githubusercontent.com/daa52099573be5a50c320c4387496400f2f722e49f86a42db8d5778130d3582d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e3f7374796c653d666f722d7468652d6261646765)

---

📦 Features
==========

[](#-features)

- Logs **created**, **updated**, and **deleted** events.
- Detects **changed attributes only** (for update).
- Logs to dedicated **storage/logs/activity-YYYY-MM-DD.log**.
- Includes Laravel Blade **log viewer page**.
- Supports **filters** (date, action, search).
- Plug-and-play trait `HasRastActivityLog`.

---

🚀 Installation
==============

[](#-installation)

```
composer require rast/activity-log
```

Laravel will automatically discover the service provider.

---

⚙️ Configuration (Optional)
===========================

[](#️-configuration-optional)

Publish config:

```
php artisan vendor:publish --tag=activitylog-config
```

This publishes:

```
config/activitylog.php

```

Inside the file:

```
return [
    'enabled' => true,
    'channel' => 'activity',
    'days' => 30,
];
```

---

🧩 Usage
=======

[](#-usage)

1. Add the Trait to Any Model
-----------------------------

[](#1-add-the-trait-to-any-model)

```
use RAST\ActivityLog\Traits\HasRastActivityLog;

class Post extends Model
{
    use HasRastActivityLog;

    protected $fillable = ['title', 'content'];

    protected $logAttributes = ['title', 'content'];
}
```

For users:

```
class User extends Authenticatable
{
    use HasRastActivityLog;

    protected $logAttributes = ['name', 'email'];
}
```

---

🧪 What Gets Logged?
===================

[](#-what-gets-logged)

### 1. **Created Event**

[](#1-created-event)

Writes full data.

### 2. **Updated Event**

[](#2-updated-event)

Writes only **changed fields**.

### 3. **Deleted Event**

[](#3-deleted-event)

Writes full data.

Example log file:

```
storage/logs/activity-2025-11-21.log

```

---

🔍 View Logs in Browser
======================

[](#-view-logs-in-browser)

Visit:

```
/activity-log

```

Includes filters:

- Date
- Action (create/update/delete)
- Search (model name, user ID, record ID)

---

📁 Log Structure
===============

[](#-log-structure)

Each log entry example:

```
{
  "action": "updated",
  "model": "User",
  "id": 3,
  "changes": {
    "email": {
      "old": "old@mail.com",
      "new": "new@mail.com"
    }
  },
  "user_id": 1
}
```

---

📂 File Logging Channel
======================

[](#-file-logging-channel)

The package auto-registers a custom channel:

```
'activity' => [
    'driver' => 'single',
    'path' => storage_path('logs/activity-' . date('Y-m-d') . '.log'),
    'level' => 'info',
],
```

---

📜 License
=========

[](#-license)

This package is open-sourced under the **MIT License**.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance66

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

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 ~5 days

Total

5

Last Release

203d ago

### Community

Maintainers

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

---

Top Contributors

[![raihanafroz](https://avatars.githubusercontent.com/u/30098871?v=4)](https://github.com/raihanafroz "raihanafroz (14 commits)")

### Embed Badge

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

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B11.5k](/packages/psr-log)[open-telemetry/api

API for OpenTelemetry PHP.

1941.5M276](/packages/open-telemetry-api)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2328.5M343](/packages/open-telemetry-sdk)

PHPackages © 2026

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