PHPackages                             ibrahim-kaya/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. ibrahim-kaya/error-tracker

ActiveLibrary

ibrahim-kaya/error-tracker
==========================

A Laravel package to automatically track, deduplicate, and manage unhandled exceptions with full HTTP context and statistics.

1.0.0(1mo ago)00MITPHPPHP &gt;=8.0

Since Mar 28Pushed 1mo agoCompare

[ Source](https://github.com/ibrahim-kaya/error-tracker)[ Packagist](https://packagist.org/packages/ibrahim-kaya/error-tracker)[ RSS](/packages/ibrahim-kaya-error-tracker/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Error Tracker
=====================

[](#laravel-error-tracker)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ccac16fc1e6b71c1dbf0fb2e76b7e2b7233fb7a1a3a048a591c698c7e91a3607/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6962726168696d2d6b6179612f6572726f722d747261636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ibrahim-kaya/error-tracker)[![PHP Version](https://camo.githubusercontent.com/40d4c7c6fd1f1f9063ff43eb8e76a4a6acb4006d0e5e6e5661a1a7da33583237/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e302d626c75653f7374796c653d666c61742d737175617265)](https://php.net)[![Laravel](https://camo.githubusercontent.com/d2cf12d6625f669d27ed5cd868ba9c9384e1599c9e7854f3665f645b0f81f0f9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d392532302537432532303130253230253743253230313125323025374325323031322d7265643f7374796c653d666c61742d737175617265)](https://laravel.com)[![License: MIT](https://camo.githubusercontent.com/1b01ef0024ba0866c115986b895301f657c1b21fc29f05c4844b7f2e8d89204d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e7376673f7374796c653d666c61742d737175617265)](LICENSE)

> **Turkish documentation:** [README.tr.md](README.tr.md)

A professional Laravel package that automatically captures, deduplicates, and stores all unhandled exceptions to the database — giving you a persistent, queryable history of every error your application encounters.

---

Features
--------

[](#features)

- **Zero-configuration capture** — automatically intercepts all unhandled exceptions via Laravel's `reportable()` hook. No changes to `Handler.php` or `bootstrap/app.php` required.
- **Smart deduplication** — identical errors (same class + message + file + line) are grouped into a single record. Only the occurrence count and last-seen timestamp update on repeat occurrences.
- **Manual capture** — catch blocks can report exceptions with one line using the `ErrorTracker::capture()` facade or Laravel's built-in `report()` helper.
- **Per-call severity override** — override the severity level for a specific capture call: `ErrorTracker::capture($e, ['severity' => 'critical'])`.
- **Full HTTP context** — stores the URL, HTTP method, client IP, user agent, authenticated user ID, sanitized request input, and selected headers alongside each error.
- **CLI &amp; queue support** — exceptions from Artisan commands and queued jobs are captured with null HTTP fields.
- **PSR-3 severity levels** — configurable severity mapping by exception class (debug → emergency).
- **Status lifecycle** — triage errors as `open`, `resolved`, or `ignored` directly on the model.
- **Rich statistics** — 10+ static methods on the `ErrorLog` model for building dashboards and reports.
- **Artisan commands** — `error-tracker:stats` and `error-tracker:clear` for CLI management.
- **Async queue support** — writes can be dispatched asynchronously to keep response times fast.
- **Rate limiting** — prevents the same error from flooding the queue during bursts. Each unique fingerprint is throttled to a configurable number of dispatches per time window using the Laravel cache.
- **Privacy first** — configurable field exclusion (passwords, tokens, payment data) and a header whitelist.
- **Laravel 9 / 10 / 11 / 12 compatible.**

---

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

[](#requirements)

DependencyVersionPHP&gt;= 8.0Laravel9, 10, 11, or 12---

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

[](#installation)

### 1. Install via Composer

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

```
composer require ibrahim-kaya/error-tracker
```

### 2. Run the migration

[](#2-run-the-migration)

```
php artisan migrate
```

### 3. (Optional) Publish the configuration file

[](#3-optional-publish-the-configuration-file)

```
php artisan vendor:publish --tag=error-tracker-config
```

This copies the config file to `config/error-tracker.php` where you can customize it.

> The package works out of the box without publishing the config — sensible defaults are applied automatically.

---

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

[](#configuration)

After publishing the config, open `config/error-tracker.php`:

```
return [

    // Toggle error tracking on/off without uninstalling the package.
    // Env key: ERROR_TRACKER_ENABLED
    'enabled' => env('ERROR_TRACKER_ENABLED', true),

    // Exception classes (and their subclasses) that should NOT be tracked.
    'excluded_exceptions' => [
        \Illuminate\Validation\ValidationException::class,
        \Illuminate\Auth\AuthenticationException::class,
        \Illuminate\Session\TokenMismatchException::class,
        \Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class,
        \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException::class,
    ],

    // Dispatch the DB write via a queue worker (true) or synchronously (false).
    // Env key: ERROR_TRACKER_QUEUE
    'use_queue' => env('ERROR_TRACKER_QUEUE', true),

    // Queue name to dispatch jobs onto.
    // Env key: ERROR_TRACKER_QUEUE_NAME
    'queue' => env('ERROR_TRACKER_QUEUE_NAME', 'default'),

    // Store sanitized request input alongside each error.
    'log_request_input' => true,

    // These request fields are always stripped before storage.
    'excluded_input_fields' => [
        'password', 'password_confirmation', 'token', '_token',
        'credit_card', 'cvv', 'card_number', 'ssn',
    ],

    // Store selected request headers (disabled by default for security).
    'log_request_headers' => false,

    // Only these headers are ever stored when log_request_headers is true.
    'logged_headers' => ['accept', 'accept-language', 'content-type', 'referer', 'origin'],

    // Map exception classes to PSR-3 severity levels.
    // Uses instanceof — parent classes cover all subclasses.
    'severity_map' => [
        \Illuminate\Database\QueryException::class => 'critical',
        \Illuminate\Database\Eloquent\ModelNotFoundException::class => 'warning',
        \Symfony\Component\HttpKernel\Exception\HttpException::class => 'warning',
    ],
];
```

### Environment Variables

[](#environment-variables)

KeyDefaultDescription`ERROR_TRACKER_ENABLED``true`Enable or disable tracking`ERROR_TRACKER_QUEUE``true`Use queue for async writes`ERROR_TRACKER_QUEUE_NAME``default`Queue name for jobs---

Usage
-----

[](#usage)

### Automatic Capture

[](#automatic-capture)

Once installed, **nothing extra is needed**. All unhandled exceptions are automatically intercepted and stored. The package registers a `reportable()` callback through the ServiceProvider — your existing `Handler.php` or `bootstrap/app.php` is never modified.

### Manual Capture from Try-Catch Blocks

[](#manual-capture-from-try-catch-blocks)

#### Option A — ErrorTracker Facade

[](#option-a--errortracker-facade)

```
use IbrahimKaya\ErrorTracker\Facades\ErrorTracker;

try {
    $this->processPayment($order);
} catch (\Exception $e) {
    // Capture and continue — will not re-throw
    ErrorTracker::capture($e);

    return response()->json(['error' => 'Payment failed, please retry.'], 500);
}
```

#### Option B — Per-call Severity Override

[](#option-b--per-call-severity-override)

```
use IbrahimKaya\ErrorTracker\Facades\ErrorTracker;

try {
    $this->syncInventory();
} catch (\Exception $e) {
    // Override the severity level for this specific capture
    ErrorTracker::capture($e, ['severity' => 'critical']);
}
```

#### Option C — Laravel's Built-in `report()` Helper

[](#option-c--laravels-built-in-report-helper)

Laravel's `report()` helper also triggers the package's `reportable()` callback:

```
try {
    $this->sendWelcomeEmail($user);
} catch (\Exception $e) {
    report($e); // Works with ErrorTracker automatically
    // continue with the request...
}
```

---

### Querying Errors

[](#querying-errors)

Use the `ErrorLog` Eloquent model directly:

```
use IbrahimKaya\ErrorTracker\Models\ErrorLog;

// Get all open errors, most recent first
$errors = ErrorLog::open()->orderByDesc('last_seen_at')->get();

// Get only critical errors
$critical = ErrorLog::withSeverity('critical')->get();

// Get errors for a specific exception class
$queryErrors = ErrorLog::forExceptionClass(\Illuminate\Database\QueryException::class)->get();

// Get errors within a date range
$rangeErrors = ErrorLog::dateRange('2024-01-01', '2024-03-31')->get();

// Find a specific error by fingerprint
$error = ErrorLog::where('fingerprint', $hash)->first();
```

### Status Management

[](#status-management)

```
$error = ErrorLog::find(1);

// Mark as resolved — resolves and records resolved_at
$error->markResolved();

// Mark as ignored — records ignored_at
$error->markIgnored();

// Reopen a resolved or ignored error
$error->reopen();
```

---

### Statistics

[](#statistics)

All statistics are available as static methods on the `ErrorLog` model:

```
use IbrahimKaya\ErrorTracker\Models\ErrorLog;

// Counts
ErrorLog::totalErrors();                // Total unique error groups
ErrorLog::totalErrors('open');          // Only open errors
ErrorLog::totalOccurrences();           // Sum of all occurrence counts
ErrorLog::openErrorCount();
ErrorLog::resolvedErrorCount();
ErrorLog::ignoredErrorCount();

// Rankings
ErrorLog::mostFrequent(10);             // Top 10 most-occurring errors
ErrorLog::mostRecent(10);               // Top 10 most recently seen

// Grouped aggregations
ErrorLog::statisticsByExceptionClass(5);  // Top 5 exception classes
ErrorLog::statisticsBySeverity();         // Counts grouped by severity
ErrorLog::statisticsByStatus();           // Counts grouped by status
ErrorLog::statisticsByFile(10);          // Top 10 most error-prone files

// Trends
ErrorLog::dailyStatistics(30);           // Daily counts for last 30 days
ErrorLog::errorsByDateRange('2024-01-01', '2024-12-31', 'open');

// Dashboard — single call that returns all of the above
$summary = ErrorLog::summaryStatistics(30);
// Returns: total_errors, total_occurrences, open_errors, resolved_errors,
//          ignored_errors, by_severity, by_exception_class, most_frequent,
//          most_recent, daily_trend
```

---

Artisan Commands
----------------

[](#artisan-commands)

### View Statistics

[](#view-statistics)

```
php artisan error-tracker:stats
php artisan error-tracker:stats --days=7
```

**Example output:**

```
  Error Tracker Statistics (last 30 days)
  ──────────────────────────────────────────────────────

  Overview
  Total unique errors:   42
  Total occurrences:     317

  Open:                  28
  Resolved:              10
  Ignored:               4

  By Severity
  +----------+--------------+--------------------+
  | Severity | Error Groups | Total Occurrences  |
  +----------+--------------+--------------------+
  | critical | 5            | 134                |
  | error    | 30           | 162                |
  | warning  | 7            | 21                 |
  +----------+--------------+--------------------+

  Top 5 Exception Classes
  +--------------------------------------------+--------+-------------+
  | Exception Class                            | Groups | Occurrences |
  +--------------------------------------------+--------+-------------+
  | Illuminate\Database\QueryException         | 5      | 134         |
  | ErrorException                             | 12     | 89          |
  +--------------------------------------------+--------+-------------+

```

### Clear Error Logs

[](#clear-error-logs)

```
# Delete all error logs (with confirmation prompt)
php artisan error-tracker:clear

# Delete only resolved errors
php artisan error-tracker:clear --status=resolved

# Delete resolved errors older than 30 days
php artisan error-tracker:clear --status=resolved --older-than=30

# Skip the confirmation prompt (for scheduled tasks)
php artisan error-tracker:clear --status=resolved --older-than=90 --force
```

**Options:**

OptionDefaultDescription`--status`*(all)*Filter by status: `open`, `resolved`, or `ignored``--older-than``0`Only delete records last seen more than N days ago`--force``false`Skip the confirmation prompt---

Laravel Compatibility
---------------------

[](#laravel-compatibility)

LaravelPHPSupported9.x8.0, 8.1✅10.x8.1, 8.2✅11.x8.2, 8.3✅12.x8.2, 8.3, 8.4✅The package uses `ExceptionHandler::reportable()`, which has been available since Laravel 8 and works identically across all supported versions — including Laravel 11+'s new `bootstrap/app.php` skeleton.

---

Security &amp; Privacy
----------------------

[](#security--privacy)

### What is stored

[](#what-is-stored)

FieldDescriptionException classThe PHP class name of the exceptionMessageThe exception message textFile &amp; lineWhere in the codebase the exception occurredStack traceFunction call chain (arguments excluded)URL, methodThe request URL and HTTP verbIP addressClient IP, supports IPv6User agentBrowser stringUser IDAuthenticated user's ID (cast to string)Request inputSanitized — sensitive fields strippedHeadersOnly whitelisted headers when enabled### What is never stored

[](#what-is-never-stored)

- Raw passwords or any field listed in `excluded_input_fields`
- `Authorization` headers, cookies, or session data
- Stack frame arguments (can contain models, closures, or large objects)
- File upload objects

### Rate Limiting

[](#rate-limiting)

Rate limiting prevents the same error from flooding the queue and database when it fires thousands of times per second (e.g. an exception inside a loop).

**How it works:**Each unique fingerprint is tracked in the Laravel cache. Once it is captured more than `max_attempts` times within `decay_seconds`, further dispatches are silently dropped until the window resets. The error group is still correctly recorded — only excess job dispatches are suppressed.

```
// config/error-tracker.php
'rate_limiting' => [
    'enabled'        => env('ERROR_TRACKER_RATE_LIMITING', true),
    'max_attempts'   => 5,   // allow up to 5 dispatches per window
    'decay_seconds'  => 60,  // window resets after 60 seconds
],
```

```
# Disable rate limiting entirely
ERROR_TRACKER_RATE_LIMITING=false
```

> **Note:** Rate limiting requires a cache driver that supports atomic increments (Redis, Memcached, or the database driver). If the cache driver is unavailable, the check fails open — captures are **never** dropped due to a cache failure.

---

### Excluding sensitive exception types

[](#excluding-sensitive-exception-types)

Add exception classes to the `excluded_exceptions` config key to prevent them from being tracked:

```
'excluded_exceptions' => [
    \App\Exceptions\ExpectedBusinessException::class,
    \Illuminate\Validation\ValidationException::class,
    // ...
],
```

### Disabling tracking per environment

[](#disabling-tracking-per-environment)

```
# .env.local
ERROR_TRACKER_ENABLED=false
```

---

Contributing
------------

[](#contributing)

Contributions, issues, and feature requests are welcome. Please open an issue first to discuss what you would like to change.

---

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

---

**Author:** [İbrahim Kaya](https://ibrahimkaya.dev)

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f929508275c5ec25054383133d70b12a804a513623774d46765162210669c1d7?d=identicon)[ibrahim-kaya](/maintainers/ibrahim-kaya)

---

Top Contributors

[![ibrahim-kaya](https://avatars.githubusercontent.com/u/20479749?v=4)](https://github.com/ibrahim-kaya "ibrahim-kaya (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ibrahim-kaya-error-tracker/health.svg)

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

###  Alternatives

[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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