laravelplus/user-history · v1.0.1

User History

A searchable record of what your users did, and to what. Support asks who changed a record, audit asks when. User History records model events and custom actions with the user, IP and user agent, then gives you a dashboard, an API and exports.

use LaravelPlus\UserHistory\Traits\HasUserActivity;class Post extends Model{    use HasUserActivity;}$post->recordActivity('status_changed', 'Post status updated', [    'old_status' => 'draft',    'new_status' => 'published']);
Installs419
Latestv1.0.1
PHP8.1+
Laravel10 – 12
A.MIT licensedMaintained by After.si

Powerful tools out of the box.

Support asks who changed a record, audit asks when. User History records model events and custom actions with the user, IP and user agent, then gives you a dashboard, an API and exports.

Automatic tracking

Created, updated, deleted and restored events recorded on any model with the trait.

Who and where

User, IP address and user agent on every entry.

Analytics

Built-in statistics, chart data and a dashboard widget.

Filtering

By user, action, subject and date range, in the UI and the service.

REST API

Activities, stats, chart data and search under api/user-history.

Exports

CSV and JSON, capped by a configurable record limit.

Retention

Old records cleaned up after a set number of days.

Notifications

Optional alerts for specific events.

Set up User History and start using it today.

Requires PHP 8.1+ and Laravel 10 – 12. Every step copies with one click.

Step 1
$ composer require laravelplus/user-history
Step 2
$ php artisan vendor:publish --provider="LaravelPlus\UserHistory\Providers\UserHistoryServiceProvider"
Step 3
$ php artisan migrate
Artisan commands it addsphp artisan user-history:reportphp artisan user-history:exportphp artisan user-history:cleanup

The details.

01

Configured by env

Tracking of IP, user agent and changed properties, retention, routes, API and exports all switch through USER_HISTORY_* variables.

02

Indexed for the questions you ask

One user_activities table with indexes on user, action, subject and time, so "what did this user do last week" stays fast.

03

Requirements

PHP 8.1+, Laravel 10, 11 or 12, and spatie/laravel-permission 5 or 6.

More packages.