PHPackages                             tarek111/user-activity-log-pro - 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. tarek111/user-activity-log-pro

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

tarek111/user-activity-log-pro
==============================

Full Laravel User Activity + Audit Log Package (Trait Based Auto Logging)

v1.0.0(2mo ago)03MITPHPPHP ^7.4 || ^8.0 || ^8.1 || ^8.2

Since Feb 19Pushed 2mo agoCompare

[ Source](https://github.com/myoltarek/user-acticity-log-pro)[ Packagist](https://packagist.org/packages/tarek111/user-activity-log-pro)[ RSS](/packages/tarek111-user-activity-log-pro/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

User Activity Log Package for Laravel
=====================================

[](#user-activity-log-package-for-laravel)

**Version:** 1.0.0
**Author:** Tarek

---

Description
-----------

[](#description)

This package automatically logs user activities in a Laravel application. It tracks login, logout, model creation, updates, deletions, and all requests. Guest users are also tracked. Old and new data, IP address, user agent, and session info are stored for detailed auditing.

**Features:**

- Use the `LogActivity` trait in any model to track CRUD operations.
- Middleware logs all requests automatically.
- Tracks both authenticated and guest users.
- Stores old and new data on updates/deletes.
- Captures IP, browser info, session ID, and request method.

---

Requirements
------------

[](#requirements)

- PHP &gt;= 7.4
- Laravel 7, 8, 9
- Database: MySQL / PostgreSQL / SQLite

---

Installation &amp; Setup
------------------------

[](#installation--setup)

1. Install via Composer:

License
-------

[](#license)

MIT License

```
composer require tarek111/user-activity-log-pro

php artisan vendor:publish --provider="Tarek\UserActivityLog\UserActivityLogServiceProvider"
php artisan migrate

#Configuration
config/activitylog.php
return [
    'log_methods' => ['POST', 'PUT', 'PATCH', 'DELETE'], // Methods
    'log_guest_actions' => true, // guest actions log
];

#Usage
1. Middleware

// app/Http/Kernel.php
protected $middlewareGroups = [
    'web' => [
        \Tarek\UserActivityLog\Middleware\LogUserActivity::class,
    ],
];

2. Model Trait

use Tarek\UserActivityLog\Traits\LogActivity;

class Customer extends Model
{
    use LogActivity;
}

3. Accessing Logs

UserActivityLog
use Tarek\UserActivityLog\Models\UserActivityLog;

// latest 10 logs
$logs = UserActivityLog::latest()->take(10)->get();

4. Example Columns

| Column       | Description                                   |
| ------------ | --------------------------------------------- |
| id           | Log ID                                        |
| user_id      | User ID (Guest hole null)                     |
| action       | login, logout, create, update, delete, action |
| description  | Model or action description                   |
| model        | Model class name (if applicable)              |
| model_id     | Model ID (if applicable)                      |
| old_data     | Old data before update/delete                 |
| new_data     | New data after create/update                  |
| is_logged_in | User login status                             |
| ip_address   | User IP                                       |
| user_agent   | Browser info                                  |
| method       | HTTP method                                   |
| url          | Request URL                                   |
| session_id   | Session ID                                    |
| created_at   | Timestamp                                     |

5. Logging Custom Actions
use Tarek\UserActivityLog\Helpers\ActivityLogger;

ActivityLogger::log('action', 'Custom user action', [
    'model' => Customer::class,
    'model_id' => $customer->id,
    'old_data' => $customer->getOriginal(),
    'new_data' => $customer->toArray()
]);

6. Blade Example

            Log ID
            User
            Action
            Description
            Old Data
            New Data
            IP
            Created At

        @foreach($activity_logs as $log)

            {{ $log->id }}
            {{ $log->user_id ?? 'Guest' }}
            {{ ucfirst($log->action) }}
            {{ $log->description }}
            >{{ json_encode($log->old_data, JSON_PRETTY_PRINT) }}
            >{{ json_encode($log->new_data, JSON_PRETTY_PRINT) }}
            {{ $log->ip_address }}
            {{ $log->created_at }}

        @endforeach

```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance83

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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

89d ago

### Community

Maintainers

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

---

Top Contributors

[![myoltarek](https://avatars.githubusercontent.com/u/159687750?v=4)](https://github.com/myoltarek "myoltarek (5 commits)")

### Embed Badge

![Health badge](/badges/tarek111-user-activity-log-pro/health.svg)

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

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

86910.0M83](/packages/spatie-laravel-health)[beyondcode/laravel-server-timing

Add Server-Timing header information from within your Laravel apps.

5712.0M1](/packages/beyondcode-laravel-server-timing)[rollbar/rollbar-laravel

Rollbar error monitoring integration for Laravel projects

14110.4M7](/packages/rollbar-rollbar-laravel)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[kitloong/laravel-app-logger

Laravel log for your application

101.2M8](/packages/kitloong-laravel-app-logger)[label84/laravel-auth-log

Log user authentication actions in Laravel.

3654.0k](/packages/label84-laravel-auth-log)

PHPackages © 2026

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