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
Requires
- php: ^8.1|^8.2|^8.3
- guzzlehttp/guzzle: ^7.0
- illuminate/database: ^10.0|^11.0
- illuminate/queue: ^10.0|^11.0
- illuminate/support: ^10.0|^11.0
Requires (Dev)
- laravel/pint: ^1.0
- mockery/mockery: ^1.5
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-10-29 06:28:51 UTC
README
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
- Selim Reza - Creator & Maintainer
- All Contributors
๐ License
The MIT License (MIT). Please see License File for more information.