PHPackages                             sergeahouansinou/laravel-error-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. sergeahouansinou/laravel-error-tracker

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

sergeahouansinou/laravel-error-tracker
======================================

A simple self-hosted Laravel package for tracking and logging exceptions in your projects.

001BladeCI passing

Since Feb 10Pushed 1mo agoCompare

[ Source](https://github.com/sergeahouansinou/laravel-exception-tracker)[ Packagist](https://packagist.org/packages/sergeahouansinou/laravel-error-tracker)[ RSS](/packages/sergeahouansinou-laravel-error-tracker/feed)WikiDiscussions main Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

🚨 Laravel Exception Tracker
---------------------------

[](#-laravel-exception-tracker)

[![Packagist Version](https://camo.githubusercontent.com/2fa53336e9e0aaa0d30c02899246132cd74e59a8ce9bae94b6e5590cf26dee2d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736572676561686f75616e73696e6f752f6c61726176656c2d657863657074696f6e2d747261636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sergeahouansinou/laravel-exception-tracker)[![Packagist Downloads](https://camo.githubusercontent.com/ba50997bc1878ed0aa94c09f86c5a10fb19dcdf48e6456442f84ec6272fff8cf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736572676561686f75616e73696e6f752f6c61726176656c2d657863657074696f6e2d747261636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sergeahouansinou/laravel-exception-tracker)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE)

A self-hosted Laravel package for tracking and logging exceptions with automatic email notifications. Inspired by Sentry, but 100% under your control — no data sent to third parties.

✨ Features
----------

[](#-features)

- 📦 **Automatic exception capture** via Laravel's `reportable()` hook — never replaces the existing Handler
- 💾 **Database storage** in a dedicated `exception_logs` table
- 📬 **Professional HTML email notifications** with a Sentry-inspired template
- 🔒 **Sensitive data filtering** (passwords, tokens, secrets masked automatically)
- ⚙️ **Configurable exception filtering** — ignore ValidationException, AuthenticationException, etc.
- 🚀 **Async email sending** via Laravel queues (non-blocking)
- 🧹 **Artisan command** to purge old logs
- 📡 **REST API** to consult exception logs
- 🧰 Compatible with **Laravel 9 to 12**

📋 Requirements
--------------

[](#-requirements)

- **PHP** &gt;= 8.0
- **Laravel** 9, 10, 11, or 12
- A configured **database** connection (MySQL, PostgreSQL, SQLite, etc.)
- A configured **mail** driver (for email notifications)

🚀 Quick Start — Adding to a Laravel Project
-------------------------------------------

[](#-quick-start--adding-to-a-laravel-project)

Follow these steps to integrate Laravel Exception Tracker into a new or existing Laravel project.

### Step 1 — Create a Laravel project (skip if you already have one)

[](#step-1--create-a-laravel-project-skip-if-you-already-have-one)

```
composer create-project laravel/laravel my-project
cd my-project
```

### Step 2 — Install the package via Composer

[](#step-2--install-the-package-via-composer)

```
composer require sergeahouansinou/laravel-exception-tracker
```

> **Auto-discovery**: The service provider (`ExceptionTrackerServiceProvider`) is registered automatically via Laravel's package auto-discovery. No manual registration in `config/app.php` is needed.

### Step 3 — Publish configuration and views

[](#step-3--publish-configuration-and-views)

```
php artisan vendor:publish --tag=exception-tracker-config
php artisan vendor:publish --tag=exception-tracker-views
```

### Step 4 — Run migrations

[](#step-4--run-migrations)

```
php artisan migrate
```

This creates the `exception_logs` table in your database.

### Step 5 — Configure your `.env`

[](#step-5--configure-your-env)

Add the following variables to your `.env` file:

```
# Exception Tracker
EXCEPTION_TRACKER_ENABLED=true
EXCEPTION_TRACKER_EMAIL_ENABLED=true
EXCEPTION_TRACKER_RECIPIENTS=admin@example.com,dev@example.com
EXCEPTION_TRACKER_QUEUE_ENABLED=true
EXCEPTION_TRACKER_QUEUE_CONNECTION=null
EXCEPTION_TRACKER_QUEUE_NAME=default
```

> **Note**: By default, tracking is **disabled** in the `local` and `testing` environments. To enable it locally, remove `local` from the `disabled_environments` array in `config/exception-tracker.php`.

### Step 6 — Configure mail (for email notifications)

[](#step-6--configure-mail-for-email-notifications)

Make sure your Laravel project has a working mail driver configured in `.env`:

```
MAIL_MAILER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=587
MAIL_USERNAME=your@email.com
MAIL_PASSWORD=your-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=no-reply@example.com
MAIL_FROM_NAME="${APP_NAME}"
```

### Step 7 — (Optional) Start a queue worker for async emails

[](#step-7--optional-start-a-queue-worker-for-async-emails)

If `EXCEPTION_TRACKER_QUEUE_ENABLED=true` (the default), emails are sent via a Laravel queue. Start a worker to process them:

```
php artisan queue:work
```

That's it! Laravel Exception Tracker is now active. Any unhandled exception in your application will be automatically captured, stored in the database, and reported by email.

---

⚙️ Installation
---------------

[](#️-installation)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require sergeahouansinou/laravel-exception-tracker
```

### 2. Publish configuration and views

[](#2-publish-configuration-and-views)

```
php artisan vendor:publish --tag=exception-tracker-config
php artisan vendor:publish --tag=exception-tracker-views
```

### 3. Run migrations

[](#3-run-migrations)

```
php artisan migrate
```

### 4. Configure your `.env`

[](#4-configure-your-env)

```
EXCEPTION_TRACKER_ENABLED=true
EXCEPTION_TRACKER_EMAIL_ENABLED=true
EXCEPTION_TRACKER_RECIPIENTS=admin@example.com,dev@example.com
EXCEPTION_TRACKER_QUEUE_ENABLED=true
EXCEPTION_TRACKER_QUEUE_CONNECTION=null
EXCEPTION_TRACKER_QUEUE_NAME=default
```

🛠️ Configuration
----------------

[](#️-configuration)

The published config file (`config/exception-tracker.php`) supports:

OptionDescriptionDefault`enabled`Enable/disable exception tracking`true``email_enabled`Enable/disable email notifications`true``recipients`List of email addresses to notify`[]``queue.enabled`Send emails via queue (async)`true``queue.connection`Queue connection name`null``queue.queue`Queue name`default``ignored_exceptions`Exception classes to skipValidationException, AuthenticationException, etc.`disabled_environments`Environments where tracking is disabled`['local', 'testing']``sensitive_fields`Fields to mask in request data`['password', 'token', 'secret', ...]``stack_trace_limit`Max stack trace frames`20``max_days`Days to retain logs`30`📧 Email Template
----------------

[](#-email-template)

The email template is a professional, responsive HTML design inspired by Sentry, with clear sections:

- **Error Summary** — Exception class, message, file and line
- **Stack Trace** — Formatted, limited, monospace display
- **Request Details** — URL, method, IP address
- **Request Headers &amp; Body** — With sensitive data masked
- **Authenticated User** — ID and email
- **Environment** — App name, environment, PHP/Laravel versions, server, timestamp, request ID

The template is publishable and fully customizable:

```
php artisan vendor:publish --tag=exception-tracker-views
```

📝 Usage
-------

[](#-usage)

### Automatic Capture

[](#automatic-capture)

The package hooks into Laravel's exception handler via `reportable()`. All unhandled exceptions are automatically captured and reported — no code changes needed.

### Manual Tracking

[](#manual-tracking)

```
use ExceptionTracker\ExceptionTracker;

try {
    // risky operation
} catch (\Throwable $e) {
    ExceptionTracker::handle($e);
}
```

Or use the helper function:

```
exception_tracker_log($e);
```

### Middleware (Optional)

[](#middleware-optional)

For route-specific tracking:

```
use ExceptionTracker\Http\Middleware\TrackExceptions;

Route::middleware(TrackExceptions::class)->group(function () {
    // your routes
});
```

📡 REST API
----------

[](#-rest-api)

- `GET /api/exception-tracker` — List exception logs (paginated)
- `GET /api/exception-tracker/{id}` — Get a single exception log

🧹 Artisan Commands
------------------

[](#-artisan-commands)

```
# Purge old exception logs
php artisan exception-tracker:clear
```

🏗️ Architecture
---------------

[](#️-architecture)

ClassRole`ExceptionTrackerServiceProvider`Registers config, views, migrations, routes, commands, and hooks into `reportable()``ExceptionTracker`Orchestrator — filters, builds payload, stores, and notifies`PayloadBuilder`Builds structured error payloads with HTTP context, user, and environment`ExceptionOccurred`Mailable class for sending HTML email notifications`ExceptionLog`Eloquent model for the `exception_logs` table`TrackExceptions`Middleware for route-specific exception tracking🔒 Security &amp; Performance
----------------------------

[](#-security--performance)

- **Fail-safe**: All internal errors are caught and logged — never crashes the host application
- **Non-blocking**: Email sending via Laravel queues by default
- **Data privacy**: Sensitive fields (passwords, tokens, secrets) are masked automatically
- **No host modification**: Uses `reportable()` — never replaces or wraps the Laravel exception handler

🚀 Packagist Auto-Deployment
---------------------------

[](#-packagist-auto-deployment)

This repository is configured to automatically notify [Packagist](https://packagist.org) whenever a commit is pushed to `main`/`master` or a new release is published, so the package is always up to date.

### Required GitHub Secrets

[](#required-github-secrets)

Add the following secrets to your GitHub repository (**Settings → Secrets and variables → Actions**):

SecretDescription`PACKAGIST_USERNAME`Your Packagist username`PACKAGIST_TOKEN`Your Packagist API token (found on your [Packagist profile](https://packagist.org/profile/))Once these secrets are set, every push to `main`/`master` and every published release will automatically trigger a Packagist package update.

📄 License
---------

[](#-license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance59

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 52% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4c99c624d570ef5a2242aca5df931dbccf72a39ffa0d6c3197ac2e19ea6ed604?d=identicon)[sergeahouansinou](/maintainers/sergeahouansinou)

---

Top Contributors

[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (13 commits)")[![sergeahouansinou](https://avatars.githubusercontent.com/u/194719328?v=4)](https://github.com/sergeahouansinou "sergeahouansinou (12 commits)")

### Embed Badge

![Health badge](/badges/sergeahouansinou-laravel-error-tracker/health.svg)

```
[![Health](https://phpackages.com/badges/sergeahouansinou-laravel-error-tracker/health.svg)](https://phpackages.com/packages/sergeahouansinou-laravel-error-tracker)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)

PHPackages © 2026

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