PHPackages                             karjah/laravel-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. [Framework](/categories/framework)
4. /
5. karjah/laravel-activity-log

ActiveLibrary[Framework](/categories/framework)

karjah/laravel-activity-log
===========================

Simple way to log activities in Laravel.

v1.0.0(1mo ago)01MITPHPPHP ^8.4

Since Apr 22Pushed 1mo agoCompare

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

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

Karjah Activity Log
===================

[](#karjah-activity-log)

A lightweight, fluent activity logging package for Laravel.

🚀 Installation
--------------

[](#-installation)

### Run these commands in your terminal:

[](#run-these-commands-in-your-terminal)

```
composer require karjah/laravel-activity-log
php artisan migrate
```

🛠 Usage Examples
----------------

[](#-usage-examples)

### 1. Global Helper

[](#1-global-helper)

```
activity('auth')
    ->withProperties(['ip' => '127.0.0.1'])
    ->log('User logged in');
```

### 2. Using the Facade

[](#2-using-the-facade)

```
use ActivityLog;

ActivityLog::name('orders')->log('New order placed');
```

### Manually setting the User (Causer)

[](#manually-setting-the-user-causer)

By default, the package uses `Auth::id()`. To override this (e.g., in a Job or for Admin actions):

```
//Pass in the user object
activity()->causedBy($user)->log('Manual action logged');

// User the user's id
activity()->causedBy(6)->log('Manual action logged');
```

### 3. Custom Caused By

[](#3-custom-caused-by)

By default, the current logged in user is used. To use a different user, pass in the id of a user or the User object.

```
activity()->name('orders')->causedBy(2)->log('New order placed');

activity()->name('orders')->causedBy($adminUser)->log('New order placed');
```

🔍 Querying &amp; Filtering Logs
-------------------------------

[](#-querying--filtering-logs)

Since the package uses a standard Eloquent model, you can filter logs using familiar Laravel syntax.

### Filter by Log Name

[](#filter-by-log-name)

Retrieve all logs for a specific area of your app, such as 'auth' or 'orders'.

```
use Karjah\ActivityLog\Models\ActivityLog;

$authLogs = ActivityLog::where('log_name', 'auth')->get();

$userLogs = ActivityLog::logName('user')->get();
```

### Filter by User

[](#filter-by-user)

```
$userLogs = ActivityLog::where('user_id', 1)->latest()->get();

$userLogs = ActivityLog::whereUser(1)->get();
```

### Filter by JSON Properties

[](#filter-by-json-properties)

```
// Find logs where the stored 'status' property is 'failed'
$failedLogs = ActivityLog::where('properties->status', 'failed')->get();
```

---

🧹 Cleaning Old Logs
-------------------

[](#-cleaning-old-logs)

To prevent your database from getting too large, you can clean up old logs manually or automatically.

### Manual Cleanup

[](#manual-cleanup)

Run this command to delete logs older than 30 days (default):

```
php artisan activitylog:clean
```

### To specify a different timeframe

[](#to-specify-a-different-timeframe)

```
php artisan activitylog:clean --days=7
```

### Automatic Cleanup (Scheduling)

[](#automatic-cleanup-scheduling)

In your main project's routes/console.php (or app/Console/Kernel.php), schedule the command to run daily:

```
use Illuminate\Support\Facades\Schedule;

Schedule::command('activitylog:clean --days=30')->daily();
```

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance90

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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

48d ago

### Community

Maintainers

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

---

Top Contributors

[![karjah](https://avatars.githubusercontent.com/u/5018964?v=4)](https://github.com/karjah "karjah (2 commits)")

---

Tags

frameworklaravellogging

### Embed Badge

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

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

###  Alternatives

[laravel/laravel

The skeleton application for the Laravel framework.

84.4k62.4M1.0k](/packages/laravel-laravel)[unopim/unopim

UnoPim Laravel PIM

10.1k2.2k](/packages/unopim-unopim)[nasirkhan/laravel-starter

A CMS like modular Laravel starter project.

1.4k2.7k](/packages/nasirkhan-laravel-starter)[codewithdennis/larament

Larament is a time-saving starter kit to quickly launch Laravel 13.x projects. It includes FilamentPHP 5.x pre-installed and configured, along with additional tools and features to streamline your development workflow.

3861.7k](/packages/codewithdennis-larament)[kompo/kompo

Laravel &amp; Vue.js FullStack Components for Rapid Application Development

11914.4k42](/packages/kompo-kompo)[ercogx/laravel-filament-starter-kit

This is a Filament v5 Starter Kit for Laravel 13, designed to accelerate the development of Filament-powered applications.

441.7k](/packages/ercogx-laravel-filament-starter-kit)

PHPackages © 2026

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