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

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

petritr/activity-log
====================

Lightweight activity logging for Laravel applications

v1.1.0(5mo ago)01MITPHPPHP ^8.1 || ^8.2 || ^8.3 || ^8.4CI passing

Since Jan 21Pushed 5mo agoCompare

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

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

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

[](#laravel-activity-log)

A small high-performance activity logging package for Laravel.
Easily track user actions, record model changes via polymorphic subjects, and store custom metadata. Designed for simplicity and flexibility, it supports both synchronous and asynchronous (queued) logging out of the box.

Key Features:

- **Fluent API**: Log activities using a clean, readable facade.
- **Polymorphic Subjects**: Link activities to any Eloquent model automatically.
- **Data Snapshots**: Automatically capture specific model attributes at the time of logging.
- **Queue Support**: Offload logging to background workers for better application performance.
- **Customizable**: Configurable fields, silent failure options, and more.

---

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

[](#installation)

Install via Composer:

```
composer require petritr/activity-log
```

Publish the config file:

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

Run migrations:

```
php artisan migrate
```

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

[](#configuration)

The package comes with a default configuration. You can customize it in `config/activity-log.php`.

You can also use environment variables in your `.env` file:

```
ACTIVITY_LOG_ENABLED=true
ACTIVITY_LOG_QUEUE_ENABLED=false
ACTIVITY_LOG_QUEUE=activity-logs
```

### Config File Options:

[](#config-file-options)

config/activity-log.php:

```
return [
    // Enable/disable logging globally
    'enabled' => true,

    // Enable/disable logging via queue
    'queue_enabled' => false,
];
```

Usage
-----

[](#usage)

Using the Facade (recommended)

```
use Petritr\ActivityLog\Facades\ActivityLog;

// Log a simple action
ActivityLog::action('user.login')->log();

// Log with a subject
ActivityLog::action('project.updated')
    ->subject($project)
    ->log();

// Log with metadata
ActivityLog::action('order.created')
    ->withMetadata(['total' => 99.90, 'items' => ['apple', 'banana']])
    ->log();
```

Subject Snapshots
-----------------

[](#subject-snapshots)

You can log a snapshot of any model or object:

```
ActivityLog::action('user.updated')
    ->subject($user)
    ->log();

```

The snapshot is stored in JSON format (subject\_snapshot) in the database.

Queue Support
-------------

[](#queue-support)

Enable queueing in config/activity-log.php:

```
'queue_enabled' => true,
```

Your activity will be dispatched to the queue using a Laravel Job.

License
-------

[](#license)

MIT License.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance71

Regular maintenance activity

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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

Total

2

Last Release

164d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/33418231?v=4)[Petrit Ramadan](/maintainers/petritr)[@petritr](https://github.com/petritr)

---

Top Contributors

[![petritr](https://avatars.githubusercontent.com/u/33418231?v=4)](https://github.com/petritr "petritr (7 commits)")

---

Tags

activity-logauditlaravellogactivity-log

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[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)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[masterro/laravel-mail-viewer

Easily view in browser outgoing emails.

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

Rapidez Core

1823.5k72](/packages/rapidez-core)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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