PHPackages                             gottvergessen/activity - 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. [Database &amp; ORM](/categories/database)
4. /
5. gottvergessen/activity

ActiveLibrary[Database &amp; ORM](/categories/database)

gottvergessen/activity
======================

A lightweight Laravel activity logging package that tracks model events with automatic observers.

v1.1.5(3mo ago)318MITPHPPHP ^8.2CI passing

Since Jan 17Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/barsch123/activity)[ Packagist](https://packagist.org/packages/gottvergessen/activity)[ Docs](https://github.com/barsch123/activity)[ GitHub Sponsors](https://github.com/Gottvergessen)[ RSS](/packages/gottvergessen-activity/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (8)Versions (8)Used By (0)

Logger
======

[](#logger)

[![Tests](https://github.com/barsch123/activity/actions/workflows/run-tests.yml/badge.svg)](https://github.com/barsch123/activity/actions/workflows/run-tests.yml)[![Packagist Version](https://camo.githubusercontent.com/d9562ca5706928900a7b865c84d16054a26e780e9dbca49f5af7ed66983dace4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f676f747476657267657373656e2f61637469766974792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gottvergessen/activity)[![License](https://camo.githubusercontent.com/b8976cb34a6b4a43a192c2d1d0cadcfaf58cbb5a96cea55f07c92eed8c922d9c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f676f747476657267657373656e2f61637469766974792e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

Logger is a lightweight, opinionated activity logging package for Laravel that automatically tracks model changes and records who did what, to which model, and when — without polluting your domain logic.

**Features:**

- Automatic tracking of model changes (create, update, delete, restore)
- Privacy-first with explicit opt-in for sensitive data
- Flexible configuration per model or globally
- Query scopes for easy filtering and analysis
- Batch operations to group related changes
- Lightweight and performant
- Built-in pruning command for cleanup
- Comprehensive audit trails

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

[](#installation)

You can install the package via composer:

```
composer require gottvergessen/activity
```

### Publish Assets

[](#publish-assets)

Publish the configuration file and migrations:

```
php artisan activity:install
```

This will create:

- `config/activity.php` - Configuration file
- `database/migrations/[timestamp]_create_logger_table.php` - Database migration

You can also publish assets separately:

```
# Publish just the config file
php artisan vendor:publish --provider="Gottvergessen\Activity\ActivityServiceProvider" --tag="config"

# Publish just the migrations
php artisan vendor:publish --provider="Gottvergessen\Activity\ActivityServiceProvider" --tag="migrations"
```

### Run Migrations

[](#run-migrations)

After publishing, run the migrations to create the `activity_logs` table:

```
php artisan migrate
```

### Pruning Old Logs

[](#pruning-old-logs)

To keep your database clean, you can prune old activity logs:

```
# Keep only the last 90 days (default)
php artisan activity:prune

# Keep only the last 30 days
php artisan activity:prune --days=30
```

### config/activity.php

[](#configactivityphp)

```
