PHPackages                             errorwatch/sdk-laravel - 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. errorwatch/sdk-laravel

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

errorwatch/sdk-laravel
======================

Laravel SDK for ErrorWatch - Self-hosted error monitoring and APM

v1.0.0(3mo ago)03MITPHPPHP ^8.1CI passing

Since Mar 30Pushed 2mo agoCompare

[ Source](https://github.com/MakFly/errorwatch-sdk-laravel)[ Packagist](https://packagist.org/packages/errorwatch/sdk-laravel)[ RSS](/packages/errorwatch-sdk-laravel/feed)WikiDiscussions main Synced 2mo ago

READMEChangelog (2)Dependencies (22)Versions (4)Used By (0)

 [ ![ErrorWatch](https://raw.githubusercontent.com/MakFly/errorwatch-sdk-laravel/main/docs/logo.svg) ](https://errorwatch.io)

ErrorWatch Laravel SDK
======================

[](#errorwatch-laravel-sdk)

 **Self-hosted error monitoring &amp; APM for Laravel applications**

 [ ![Latest Version on Packagist](https://camo.githubusercontent.com/38529eb84fd066d98f6682443210526ece61880b64ac135582e7d6ccd7ab128c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6572726f7277617463682f73646b2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265) ](https://packagist.org/packages/errorwatch/sdk-laravel) [ ![Total Downloads](https://camo.githubusercontent.com/d8d6e35adaf71bdcbcdf0ee9610e009a9f56dd257467f8f2fa73995a6ca7d3cf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6572726f7277617463682f73646b2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265) ](https://packagist.org/packages/errorwatch/sdk-laravel) [ ![Build Status](https://camo.githubusercontent.com/c04146b06b335e14372b49fe3b1a46a62e1d88e375d218b2d884ad6f17e2f6e0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f4d616b466c792f6572726f7277617463682d73646b2d6c61726176656c2f74657374732e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265) ](https://github.com/MakFly/errorwatch-sdk-laravel/actions) [ ![License - MIT](https://camo.githubusercontent.com/544c168efd10e5b509930a5d14091d0340bdba02eef69cae387bc2bcbba1f289/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6572726f7277617463682f73646b2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265266c6162656c3d4c6963656e7365) ](LICENSE) [ ![PHP Version](https://camo.githubusercontent.com/e9b372dfbb8423abb6997975bdb8839461065d670262994626f8fab841afecda/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6572726f7277617463682f73646b2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265) ](https://php.net)

 [Installation](#installation) • [Quick Start](#quick-start) • [Features](#features) • [Configuration](#configuration) • [Documentation](#documentation)

---

> **v1.0.0** — Production-ready. Resilient transport (circuit breaker, retry, deduplication), 102 tests passing across PHP 8.1-8.4 × Laravel 10-12. See [CHANGELOG](CHANGELOG.md) for details.

---

Why ErrorWatch?
---------------

[](#why-errorwatch)

**Self-hosted error monitoring** that doesn't cost a fortune. Unlike Sentry's per-event pricing, ErrorWatch runs on your infrastructure with predictable costs.

- 🔒 **Full Data Ownership** - All error data stays on your servers
- 💰 **Predictable Costs** - No per-event pricing surprises
- ⚡ **Zero Vendor Lock-in** - Standard SQL database, easy to export
- 🎯 **Laravel Native** - Built specifically for Laravel, by Laravel developers

Features
--------

[](#features)

### Error Monitoring

[](#error-monitoring)

- ✅ **Automatic Exception Capture** - Unhandled exceptions are caught automatically
- ✅ **Stack Trace Parsing** - Clean, readable stack traces with context
- ✅ **Error Grouping** - Smart fingerprinting groups similar errors
- ✅ **Breadcrumbs** - 360° context for every error (HTTP, DB, Auth, Queue, Console)

### Performance Monitoring (APM)

[](#performance-monitoring-apm)

- ✅ **Request Tracing** - End-to-end transaction tracking
- ✅ **Eloquent Query Spans** - See every database query with duration
- ✅ **N+1 Detection** - Automatic alerts for repeated queries
- ✅ **Slow Query Alerts** - Configurable threshold for query performance
- ✅ **HTTP Client Tracing** - Track outgoing API calls

### Laravel Integration

[](#laravel-integration)

- ✅ **Queue Job Monitoring** - Failed jobs captured with full context
- ✅ **Auth Integration** - Automatic user context from authenticated requests
- ✅ **Console Commands** - Track Artisan command execution and failures
- ✅ **Monolog Handler** - Forward logs to ErrorWatch in real-time
- ✅ **Session Replay** - Replay user sessions to understand errors

### Developer Experience

[](#developer-experience)

- ✅ **Auto-Discovery** - Zero-configuration service provider
- ✅ **Artisan Commands** - `errorwatch:install` and `errorwatch:test`
- ✅ **Blade Directive** - `@errorwatchReplay()` for session recording
- ✅ **Facade** - Clean `ErrorWatch::captureException()` syntax

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

[](#requirements)

RequirementVersionPHP^8.1Laravel10.x, 11.x, 12.xGuzzle^7.0Installation
------------

[](#installation)

Install via Composer:

```
composer require errorwatch/sdk-laravel
```

Publish the configuration file:

```
php artisan vendor:publish --tag=errorwatch-config
```

Add your ErrorWatch credentials to `.env`:

```
ERRORWATCH_ENABLED=true
ERRORWATCH_ENDPOINT=https://api.errorwatch.io
ERRORWATCH_API_KEY=your-api-key-here
```

Test the installation:

```
php artisan errorwatch:test
```

That's it! Your Laravel application is now monitoring errors.

Quick Start
-----------

[](#quick-start)

### Automatic Error Capture

[](#automatic-error-capture)

Errors are captured automatically via middleware. No code changes needed!

```
// This exception will be automatically captured and sent to ErrorWatch
throw new RuntimeException('Something went wrong');
```

### Manual Exception Capture

[](#manual-exception-capture)

```
use ErrorWatch\Laravel\Facades\ErrorWatch;

try {
    // Risky operation
    ProcessPayment::dispatch($order);
} catch (PaymentFailedException $e) {
    // Capture with additional context
    ErrorWatch::captureException($e, [
        'extra' => [
            'order_id' => $order->id,
            'amount' => $order->total,
        ],
        'tags' => [
            'payment_provider' => 'stripe',
        ],
    ]);

    throw $e;
}
```

### Add Context with Breadcrumbs

[](#add-context-with-breadcrumbs)

```
use ErrorWatch\Laravel\Facades\ErrorWatch;

// Track user actions
ErrorWatch::addBreadcrumb('User initiated checkout', 'user', [
    'cart_items' => 3,
    'cart_total' => 149.99,
]);

// When an error occurs later, you'll see the full context!
```

### Set User Context

[](#set-user-context)

```
// In your authentication listener or middleware
ErrorWatch::setUser([
    'id' => auth()->id(),
    'email' => auth()->user()->email,
    'username' => auth()->user()->name,
]);

// Now every error includes who experienced it
```

### APM Transactions

[](#apm-transactions)

```
use ErrorWatch\Laravel\Facades\ErrorWatch;

// Track custom operations
$transaction = ErrorWatch::startTransaction('process-payout');
$transaction->setTag('payout.method', 'bank_transfer');

$span = $transaction->startChild('api-call', 'http.client');
// ... make external API call
$span->finish();

ErrorWatch::finishTransaction();
```

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

[](#configuration)

All configuration options in `config/errorwatch.php`:

```
return [
    // Core
    'enabled' => env('ERRORWATCH_ENABLED', true),
    'endpoint' => env('ERRORWATCH_ENDPOINT'),
    'api_key' => env('ERRORWATCH_API_KEY'),
    'environment' => env('APP_ENV', 'production'),
    'release' => env('APP_VERSION'),

    // Session Replay
    'replay' => [
        'enabled' => env('ERRORWATCH_REPLAY_ENABLED', false),
        'sample_rate' => env('ERRORWATCH_REPLAY_SAMPLE_RATE', 0.1),
    ],

    // Breadcrumbs
    'breadcrumbs' => [
        'enabled' => true,
        'max_count' => 100,  // Keep last 100 breadcrumbs
    ],

    // User Context
    'user_context' => [
        'enabled' => true,
        'capture_ip' => true,
    ],

    // Queue Monitoring
    'queue' => [
        'enabled' => true,
        'capture_retries' => false,  // Only capture final failures
    ],

    // APM
    'apm' => [
        'enabled' => true,
        'eloquent' => [
            'enabled' => true,
            'log_queries' => true,
        ],
        'http_client' => [
            'enabled' => true,
        ],
        'n_plus_one_threshold' => 5,      // Alert after 5 identical queries
        'slow_query_threshold_ms' => 500,  // Alert queries > 500ms
        'excluded_routes' => ['telescope/*', 'horizon/*'],
    ],

    // Logging (Laravel-native, replaces Monolog)
    'logging' => [
        'enabled' => true,
        'level' => 'error',  // debug, info, notice, warning, error, critical, alert, emergency
        'excluded_channels' => ['errorwatch'],
    ],

    // Exceptions
    'exceptions' => [
        'enabled' => true,
    ],
];
```

Session Replay
--------------

[](#session-replay)

Enable session replay to see exactly what users did before an error:

```
ERRORWATCH_REPLAY_ENABLED=true
ERRORWATCH_REPLAY_SAMPLE_RATE=0.1  # 10% of sessions
```

Add to your layout Blade file:

```

    {{ config('app.name') }}
    @errorwatchReplay()

    @yield('content')

```

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

[](#artisan-commands)

### Install Command

[](#install-command)

```
php artisan errorwatch:install

# Output:
# ✓ Configuration file published to config/errorwatch.php
#
# Next steps:
# 1. Add ERRORWATCH_ENDPOINT and ERRORWATCH_API_KEY to your .env
# 2. Run php artisan errorwatch:test to verify
```

### Test Command

[](#test-command)

```
# Send a test message
php artisan errorwatch:test

# Send a test exception
php artisan errorwatch:test --exception

# Custom message
php artisan errorwatch:test --message="Testing from production"
```

Automatic Integrations
----------------------

[](#automatic-integrations)

The SDK automatically integrates with these Laravel features:

IntegrationWhat it captures**HTTP Middleware**Request/response timing, exceptions**Eloquent ORM**SQL queries, duration, N+1 patterns**Queue Workers**Job failures, retries, duration**Auth**User context on login/logout**HTTP Client**Outgoing API calls with timing**Console**Command execution, exit codes**Monolog**Log entries above thresholdSelf-Hosting ErrorWatch
-----------------------

[](#self-hosting-errorwatch)

ErrorWatch is self-hosted. Deploy your own instance:

```
# Using Docker Compose
git clone https://github.com/MakFly/errorwatch
cd errorwatch
docker-compose up -d
```

See the [ErrorWatch repository](https://github.com/MakFly/errorwatch) for detailed setup instructions.

Documentation
-------------

[](#documentation)

- 📖 [ErrorWatch Repository](https://github.com/MakFly/errorwatch)
- 🔌 [Self-Hosting](https://github.com/MakFly/errorwatch#readme)

Comparison with Sentry
----------------------

[](#comparison-with-sentry)

FeatureErrorWatchSentrySelf-hosted✅⚠️ (Enterprise only)PricingFree (self-hosted)Per-eventData ownership100% yoursStored by SentryLaravel native✅⚠️ (Generic SDK)N+1 detection✅❌Session replay✅💰 Paid add-onContributing
------------

[](#contributing)

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

```
# Run tests
composer test

# Run static analysis
composer stan
```

Security
--------

[](#security)

If you discover a security vulnerability, please email . All security vulnerabilities will be promptly addressed.

License
-------

[](#license)

The MIT License (MIT). See [LICENSE](LICENSE) for more information.

Support
-------

[](#support)

- 📧 Email:
- 💬 Discord: [Join our community](https://discord.gg/errorwatch)
- 🐛 Issues: [GitHub Issues](https://github.com/MakFly/errorwatch-sdk-laravel/issues)

---

 Made with ❤️ by the [ErrorWatch Team](https://errorwatch.io)

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance83

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

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 ~18 days

Total

3

Last Release

95d ago

Major Versions

v0.5.0 → v1.0.02026-03-30

### Community

Maintainers

![](https://www.gravatar.com/avatar/36bd784d4a0a99b303da318f09603e9861ed9a0cabc2135103eb9954f2d7362c?d=identicon)[MakFly](/maintainers/MakFly)

---

Top Contributors

[![MakFly](https://avatars.githubusercontent.com/u/6107225?v=4)](https://github.com/MakFly "MakFly (27 commits)")

---

Tags

laravelloggingperformanceexceptionapmtracingerror-monitoringsentry-alternativeerrorwatch

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/errorwatch-sdk-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/errorwatch-sdk-laravel/health.svg)](https://phpackages.com/packages/errorwatch-sdk-laravel)
```

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[laravel/pulse

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

1.7k15.1M131](/packages/laravel-pulse)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M165](/packages/spatie-laravel-health)[aedart/athenaeum

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

245.2k](/packages/aedart-athenaeum)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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