impactlabs/laravel-error-tracker

Track errors by their business impact - know which bugs cost you money. Lightweight alternative to Sentry/Flare.

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/impactlabs/laravel-error-tracker

dev-master 2025-10-29 06:25 UTC

This package is auto-updated.

Last update: 2025-10-29 06:28:51 UTC


README

Latest Version on Packagist Total Downloads GitHub Tests Action Status

A Laravel package that tracks not just errors, but their business impact. Perfect for SaaS, AdTech, and e-commerce platforms where errors have measurable financial consequences.

๐ŸŽฏ What Makes This Different

Unlike traditional error trackers, this package answers:

  • "Which errors are costing us money?"
  • "Which customers are affected?"
  • "Should we fix this NOW or later?"

โœจ Features

  • ๐ŸŽฏ Business Impact Tracking - Track revenue loss, affected customers, and business metrics
  • ๐Ÿ”ฅ Smart Priority Scoring - Automatically prioritize errors by business impact
  • ๐Ÿ“Š Context Enrichment - Capture business entities, user context, and system state
  • ๐Ÿ”” Intelligent Notifications - WhatsApp, Slack, Email with actionable insights
  • ๐Ÿ“ก Flexible Forwarding - Send logs to Elasticsearch, Graylog, Sentry, Datadog, etc.
  • โšก Lightweight & Fast - <500KB memory, 3-6ms execution (async mode)
  • ๐ŸŽจ Simple Usage - One-line trait implementation

๐Ÿ“ฆ Installation

composer require impactlabs/laravel-error-tracker

Publish the config and migrations:

php artisan vendor:publish --tag=error-tracker
php artisan migrate

๐Ÿš€ Quick Start

Option 1: Using Traits (Recommended)

use ImpactLabs\ErrorTracker\Traits\TracksBusinessErrors;

class Campaign extends Model
{
    use TracksBusinessErrors;
    
    public function process()
    {
        try {
            // Your business logic
        } catch (\Exception $e) {
            // One line - auto-detects context!
            $this->reportError($e);
            throw $e;
        }
    }
}

Option 2: Manual Reporting

use ImpactLabs\ErrorTracker\Facades\ErrorTracker;

ErrorTracker::report($exception)
    ->withAdvertiser($advertiserId)
    ->withCampaign($campaignId)
    ->withRevenueImpact(5000.00)
    ->withUserTier('premium')
    ->send();

Option 3: Global Handler

// In app/Exceptions/Handler.php
public function register()
{
    $this->reportable(function (\Throwable $e) {
        \ImpactLabs\ErrorTracker\Facades\ErrorTracker::report($e)->send();
    });
}

โš™๏ธ Configuration

Configure in .env:

# Enable tracking
ERROR_TRACKER_ENABLED=true
ERROR_TRACKER_ASYNC=true

# Elasticsearch forwarding
ES_ERROR_TRACKER_ENABLED=true
ES_ERROR_TRACKER_HOST=http://localhost:9200

# WhatsApp notifications
WHATSAPP_ERROR_ENABLED=true
WHATSAPP_API_URL=your-whatsapp-api-url
WHATSAPP_ERROR_PHONE=8801234567890
WHATSAPP_ACCESS_TOKEN=your-token

# Slack notifications
SLACK_ERROR_ENABLED=true
SLACK_ERROR_WEBHOOK=your-slack-webhook

๐Ÿ“Š View Top Errors

# Show top errors by priority
php artisan error-tracker:top

# Show by revenue impact
php artisan error-tracker:top --by=revenue

# Show for specific advertiser
php artisan error-tracker:top --advertiser=123

๐Ÿ”Œ Supported Log Forwarders

Self-hosted

  • โœ… Elasticsearch
  • โœ… Graylog
  • โœ… Grafana Loki

Managed Services

  • โœ… Sentry
  • โœ… Datadog
  • โœ… Logtail (Better Stack)

Custom

  • โœ… Any HTTP endpoint

๐Ÿงช Testing

composer test

๐Ÿ“ Changelog

Please see CHANGELOG for more information on what has changed recently.

๐Ÿค Contributing

Contributions are welcome! Please see CONTRIBUTING for details.

๐Ÿ”’ Security

If you discover any security related issues, please email selimppc@gmail.com instead of using the issue tracker.

๐Ÿ’– Credits

๐Ÿ“„ License

The MIT License (MIT). Please see License File for more information.