Download the PHP package henryavila/email-tracking without Composer
On this page you can find all versions of the php package henryavila/email-tracking. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download henryavila/email-tracking
More information about henryavila/email-tracking
Files in henryavila/email-tracking
Package email-tracking
Short Description Track e-mail delivery with Mailgun Hooks. All data are stored in the database on Email model
License MIT
Homepage https://github.com/henryavila/email-tracking
Informations about the package email-tracking
Laravel Email Tracking with Mailgun
Track email delivery, opens, clicks, and more using Mailgun webhooks. All data is stored in your database for easy querying and analytics.
β¨ Features
- π§ Complete Email Tracking - Track sent, delivered, opened, clicked, bounced, and failed emails
- π Model Association - Link emails to any Eloquent model (User, Order, Invoice, etc.)
- π― Email Categorization - Classify emails by type (transactional, marketing, notifications, etc.)
- π Built-in Analytics - Query delivery rates, open rates, click rates by email type
- πͺ Mailgun Webhooks - Automatic event processing from Mailgun
- π Secure Webhooks - Signature verification for webhook security
- πΎ Database Storage - All email data stored in your database
- π§ͺ Fully Tested - Comprehensive test suite included
- π± Laravel 11+ & 12 - Modern Laravel support with latest features
π Requirements
- PHP 8.2, 8.3, or 8.4 (PHP 8.5 support planned for v7.1.0)
- Laravel 11.0 or higher (Laravel 11 LTS and Laravel 12 supported)
- Mailgun account
π Code Coverage
This package maintains high test coverage with comprehensive unit and integration tests. All new features are fully tested before release.
π¦ Installation
1. Install via Composer
2. Publish and Run Migrations
3. Publish Configuration (Optional)
4. Configure Mailgun
Setup Laravel Mail with Mailgun driver. See Laravel Mail Documentation.
Add to your .env file:
5. Setup Mailgun Webhook
In your Mailgun dashboard, add a webhook pointing to:
βοΈ Configuration
Register Event Listener
The package needs to listen for sent emails to track them.
Add to AppServiceProvider::boot():
Configuration File
The published config file (config/email-tracking.php) allows customization:
π Usage
Basic Mailable with Tracking
Extend TrackableMail instead of Laravel's Mailable:
Send the email:
The email will be automatically tracked and linked to the $order model.
Trackable Notifications
For notifications, use TrackableNotificationMailMessage:
Email Type Classification (v7.0.0+)
Categorize emails for better organization and analytics.
1. Create Email Type Enum
2. Implement in Mailable
3. Query by Type
Learn more: See Email Type Classification Documentation for complete guide with examples.
Querying Emails
Email Analytics
πͺ Webhook Events
When Mailgun processes an email event (delivered, opened, clicked, etc.), the EmailWebhookProcessed event is dispatched.
Listening to Webhook Events
Create a listener:
Register the listener in EventServiceProvider:
Available Event Types
AcceptedEmailEvent- Email accepted for deliveryDeliveredEmailEvent- Email successfully deliveredOpenedEmailEvent- Email opened by recipientClickedEmailEvent- Link clicked in emailPermanentFailureEmailEvent- Permanent delivery failure (bounce)TemporaryFailureEmailEvent- Temporary delivery issueSpamComplaintsEmailEvent- Marked as spamUnsubscribeEmailEvent- Unsubscribe request
π§ Advanced Usage
Model Association
Add the trait to models that send emails:
Now you can access emails:
Custom Email Model
Extend the base Email model to add your own methods:
Use your custom model by binding it in a service provider:
π Documentation
- Email Type Classification Guide - Complete guide for email categorization
- Changelog - Version history and upgrade guides
π§ͺ Testing
π Changelog
Please see CHANGELOG for more information on what has changed recently.
π€ Contributing
Please see CONTRIBUTING for details.
π Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
π Credits
- Henry Γvila
- All Contributors
π License
The MIT License (MIT). Please see License File for more information.
π‘ Upgrade Guides
Upgrading to 7.0.0 from 6.x - BREAKING CHANGES
Version 7.0.0 drops support for PHP 8.1 and Laravel 9-10.
Requirements
- PHP 8.2+ (was 8.1+)
- Laravel 11+ (was 9+)
Why This Change?
Laravel 10 has reached end-of-life and contains known security vulnerabilities. This major version ensures your application uses secure, actively maintained Laravel versions.
Migration Path
Code Changes Required
If you were using Laravel 10's EventServiceProvider pattern, migrate to Laravel 11's AppServiceProvider:
Before (Laravel 10):
After (Laravel 11):
Testing
The package now uses:
- Pest 3.x for testing
- PHPUnit 11.x as test runner
- PHPStan Level 4 for static analysis
All tests pass on PHP 8.2, 8.3, 8.4, and 8.5 with Laravel 11 and 12.
Upgrading to 6.2.0 from earlier versions (Legacy)
Note: If you're on v6.x, upgrade directly to v7.0.0 using the guide above.
A new migration was added to track email events.
π Support
- π Documentation
- π Issue Tracker
- π¬ Discussions
β Show Your Support
Give a βοΈ if this project helped you!
All versions of email-tracking with dependencies
spatie/laravel-package-tools Version ^1.9.2
illuminate/contracts Version ^11.0|^12.0
spatie/laravel-permission Version ^6.0