PHPackages                             abdulbaset/activity-tracker - 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. abdulbaset/activity-tracker

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

abdulbaset/activity-tracker
===========================

A comprehensive activity Tracker for Laravel projects.

2.0.0(1y ago)014MITPHPPHP ^7.4|^8.0

Since Jul 27Pushed 1y ago1 watchersCompare

[ Source](https://github.com/AbdulBasetRS/Activity-Tracker)[ Packagist](https://packagist.org/packages/abdulbaset/activity-tracker)[ Docs](https://digitalatum.com)[ RSS](/packages/abdulbaset-activity-tracker/feed)WikiDiscussions main Synced today

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

[![Thumbnail](docs/thumbnail.png)](docs/thumbnail.png)

Activity Tracker Package
========================

[](#activity-tracker-package)

A comprehensive activity tracking package for Laravel applications that logs various types of activities including authentication events, model changes, exceptions, route access, and database queries.

[![Latest Version on Packagist](https://camo.githubusercontent.com/f9bdc5f3ed6add2d0ff8904a946fddaa1154d51b7158b9683252526acfd759b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616264756c62617365742f61637469766974792d747261636b65722e737667)](https://packagist.org/packages/abdulbaset/activity-tracker)[![Total Downloads](https://camo.githubusercontent.com/47acf3a93874a03de90567fb26d4b1d4ae0286c0f0b9bb1061a8e03acb22b891/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616264756c62617365742f61637469766974792d747261636b65722e737667)](https://packagist.org/packages/abdulbaset/activity-tracker)[![License](https://camo.githubusercontent.com/d70377a1ce897c6a7d08420848ea21b0e71da9349842f9d37e159398b0ef0a2b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616264756c62617365742f61637469766974792d747261636b65722e737667)](https://packagist.org/packages/abdulbaset/activity-tracker)

Features
--------

[](#features)

- 🔐 **Authentication Tracking**: Login, logout, failed attempts, lockouts, registrations, email verifications, and password resets
- 📝 **Model Changes**: Create, update, delete, force delete, and restore operations
- ⚠️ **Exception Logging**: Various HTTP and system exceptions
- 🛣️ **Route Access**: Track accessed routes with request details
- 🔍 **Query Logging**: Monitor database queries with execution time
- 📱 **Device Information**: Browser, operating system, and device type detection
- 🔄 **Flexible Storage**: Store logs in database or files
- ⚙️ **Highly Configurable**: Extensive configuration options for each feature

Changelog
---------

[](#changelog)

All notable changes to this project will be documented in the [CHANGELOG.md](docs/CHANGELOG.md) file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

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

[](#installation)

You can install the package via composer:

```
composer require abdulbaset/activity-tracker
```

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

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --provider="Abdulbaset\ActivityTracker\Providers\ActivityTrackerServiceProvider"
```

This will create a `config/activity-tracker.php` file where you can configure various aspects of the package.

Migrations
----------

[](#migrations)

After installing the package, you need to run the migrations to create the required database tables. To do this, use the following Artisan command:

```
php artisan migrate --path=vendor/abdulbaset/activity-tracker/src/database/migrations
```

Basic Usage
-----------

[](#basic-usage)

### Manual Logging

[](#manual-logging)

```
use ActivityTracker;

// Simple activity logging
ActivityTracker::log('User Profile', 'User updated their profile');

// Detailed activity logging
ActivityTracker::log(
    'Order Created',
    'New order #123 was created',
    [
        'properties' => [
            'order_id' => 123,
            'amount' => 99.99
        ]
    ]
);
```

### Model Tracking

[](#model-tracking)

Add the `Trackable` trait to your model:

```
use Abdulbaset\ActivityTracker\Traits\Trackable;

class User extends Model
{
    use Trackable;
}
```

Configuration Options
---------------------

[](#configuration-options)

### General Configuration

[](#general-configuration)

```
return [
    'enabled' => env('ACTIVITY_TRACKER_ENABLED', true),
    'log_method' => env('ACTIVITY_TRACKER_LOG_METHOD', 'database'), // 'database' or 'file'
    'log_file_path' => storage_path('logs/activity_tracker.log'),
];
```

### Authentication Events

[](#authentication-events)

```
'auth' => [
    'enabled' => true,
    'events' => [
        'login' => true,
        'logout' => true,
        'failed' => true,
        'lockout' => true,
        'registered' => true,
        'verified' => true,
        'password_reset' => true,
    ],
],
```

### Model Events

[](#model-events)

```
'models' => [
    'enabled' => true,
    'events' => [
        'creating' => true,
        'created' => true,
        'updating' => true,
        'updated' => true,
        'deleting' => true,
        'deleted' => true,
        'force_deleting' => true,
        'force_deleted' => true,
        'restoring' => true,
        'restored' => true,
    ],
    'full_model_data' => false,
],
```

### Exception Tracking

[](#exception-tracking)

```
'exceptions' => [
    'enabled' => true,
    'events' => [
        'not_found' => true,
        'unauthorized' => true,
        'method_not_allowed' => true,
        'too_many_requests' => true,
        'conflict' => true,
        'unprocessable_entity' => true,
        'access_denied' => true,
        'gone' => true,
        'precondition_failed' => true,
        'unsupported_media_type' => true,
        'general' => true,
    ],
    'include_trace' => false,
],
```

### Exclusions

[](#exclusions)

```
'exclude' => [
    'routes' => [
        'horizon*',
        'nova*',
        '_debugbar*',
    ],
    'models' => [],
    'model_attributes' => [
        'password',
        'remember_token',
        'api_token',
        // ... other sensitive fields
    ],
],
```

Database Schema
---------------

[](#database-schema)

The package creates an `activities` table with the following structure:

ColumnTypeDescriptionidbigintPrimary keysubjectstringActivity subjectcauser\_typestringModel type of the causercauser\_idbigintID of the causermodel\_typestringRelated model typemodel\_idbigintRelated model IDeventstringEvent typebeforejsonPrevious state (for updates)afterjsonNew state (for updates)ipstringIP addressheadersjsonRequest headersquery\_parametersjsonURL query parametersrequest\_methodstringHTTP methodbrowserstringBrowser informationdevice\_typestringDevice typeoperating\_systemstringOS informationreferring\_urlstringReferrer URLcurrent\_urlstringCurrent URLdescriptiontextActivity descriptionpropertiesjsonAdditional propertiescreated\_attimestampCreation timestampupdated\_attimestampUpdate timestampAPI Resource
------------

[](#api-resource)

The package includes an API resource for formatting activity logs:

```
use Abdulbaset\ActivityTracker\Resources\ActivityTrackerResource;

// In your controller
public function index()
{
    $activities = ActivityTracker::latest()->paginate();
    return ActivityTrackerResource::collection($activities);
}
```

Events
------

[](#events)

The package tracks the following events:

### Authentication Events

[](#authentication-events-1)

- Login
- Logout
- Failed Login
- Lockout
- Registration
- Email Verification
- Password Reset

### Model Events

[](#model-events-1)

- Creating/Created
- Updating/Updated
- Deleting/Deleted
- Force Deleting/Force Deleted
- Restoring/Restored

### Exception Events

[](#exception-events)

- Not Found
- Unauthorized
- Method Not Allowed
- Too Many Requests
- Conflict
- Unprocessable Entity
- Access Denied
- Gone
- Precondition Failed
- Unsupported Media Type
- General Exceptions

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Abdulbaset R. Sayed](https://github.com/abdulbasetsayed)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Support
-------

[](#support)

For support:

- Email:
- Create an issue in the GitHub repository

Donations 💖
-----------

[](#donations-)

Maintaining this package takes time and effort. If you’d like to support its development and keep it growing, you can:

- 🌟 Star this repository
- 📢 Sharing it with others
- 🛠️ Contribute by reporting issues or suggesting features
- ☕ [Buy me a coffee](https://buymeacoffee.com/abdulbaset)
- ❤️ Become a sponsor on [GitHub Sponsors](https://github.com/sponsors/AbdulbasetRS)
- 💵 Make a one-time donation via [PayPal](https://paypal.me/abdulbasetrs)

Your support means a lot to me! Thank you for making this possible. 🙏

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

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

Every ~170 days

Total

2

Last Release

535d ago

Major Versions

1.0.0 → 2.0.02025-01-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/1d770636a8684f5b3bb07c0871140986c12f0f9a225d97d3b5fca53a5d7bdca0?d=identicon)[AbdulBasetRS](/maintainers/AbdulBasetRS)

---

Top Contributors

[![AbdulbasetRS](https://avatars.githubusercontent.com/u/74756037?v=4)](https://github.com/AbdulbasetRS "AbdulbasetRS (6 commits)")

---

Tags

phplaravelloggingpackageeventstrackingactivityaudit-trailtrackeractivitiesActivity Tracker

### Embed Badge

![Health badge](/badges/abdulbaset-activity-tracker/health.svg)

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

###  Alternatives

[pragmarx/tracker

A Laravel Visitor Tracker

2.9k307.6k1](/packages/pragmarx-tracker)[api-platform/laravel

API Platform support for Laravel

58170.8k13](/packages/api-platform-laravel)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.4k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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