PHPackages                             fullstack/inbounder - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. fullstack/inbounder

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

fullstack/inbounder
===================

A comprehensive Laravel package for Mailgun integration with email templates, distribution lists, webhook handling, and queue management.

v0.3.93(10mo ago)044MITPHPPHP ^8.2CI failing

Since Jun 28Pushed 10mo agoCompare

[ Source](https://github.com/Fullstack-LLC/Inbounder)[ Packagist](https://packagist.org/packages/fullstack/inbounder)[ RSS](/packages/fullstack-inbounder/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (107)Used By (0)

Inbounder - Laravel Mailgun Integration Package
===============================================

[](#inbounder---laravel-mailgun-integration-package)

A comprehensive Laravel package for Mailgun integration with email templates, distribution lists, webhook handling, and queue management.

Features
--------

[](#features)

- **Email Templates**: Create and manage reusable email templates with variable substitution
- **Distribution Lists**: Manage email distribution lists with subscriber management
- **Webhook Processing**: Handle Mailgun webhooks for tracking and analytics
- **Inbound Email**: Process incoming emails with attachment support
- **Queue Management**: Dedicated queue configuration for email processing
- **Authorization**: Flexible authorization system (Gates, Policies, Spatie Permissions)
- **Event System**: Comprehensive event system for all operations
- **Console Commands**: CLI tools for managing templates and distribution lists

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

[](#installation)

```
composer require fullstack/inbounder
```

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

[](#configuration)

### Basic Configuration

[](#basic-configuration)

Publish the configuration file:

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

Configure your Mailgun credentials in `.env`:

```
MAILGUN_DOMAIN=your-domain.com
MAILGUN_SECRET=your-api-key
MAILGUN_WEBHOOK_SIGNING_KEY=your-webhook-signing-key
MAIL_FROM_ADDRESS=noreply@your-domain.com
MAIL_FROM_NAME=Your App Name
```

### Queue Configuration

[](#queue-configuration)

The package supports custom queue configuration for better performance and isolation:

```
# Enable custom queue configuration
MAILGUN_QUEUE_ENABLED=true

# Default queue name
MAILGUN_QUEUE_NAME=mailgun

# Specific queue names for different job types
MAILGUN_QUEUE_TEMPLATED_EMAILS=mailgun-emails
MAILGUN_QUEUE_WEBHOOKS=mailgun-webhooks
MAILGUN_QUEUE_INBOUND=mailgun-inbound
MAILGUN_QUEUE_TRACKING=mailgun-tracking

# Queue connection (default, redis, sqs, etc.)
MAILGUN_QUEUE_CONNECTION=redis

# Retry configuration
MAILGUN_QUEUE_MAX_ATTEMPTS=3
MAILGUN_QUEUE_RETRY_DELAY=60
MAILGUN_QUEUE_BACKOFF=true

# Timeout configuration
MAILGUN_QUEUE_JOB_TIMEOUT=300
MAILGUN_QUEUE_TIMEOUT=600

# Batch processing
MAILGUN_QUEUE_BATCH_ENABLED=true
MAILGUN_QUEUE_BATCH_SIZE=100
MAILGUN_QUEUE_BATCH_DELAY=5
```

### Queue Workers

[](#queue-workers)

Set up queue workers for the Mailgun queues:

```
# Process templated emails
php artisan queue:work --queue=mailgun-emails

# Process webhook events
php artisan queue:work --queue=mailgun-webhooks

# Process inbound emails
php artisan queue:work --queue=mailgun-inbound

# Process tracking events
php artisan queue:work --queue=mailgun-tracking
```

Or use supervisor to manage multiple workers:

```
[program:mailgun-emails]
command=php /path/to/your/app/artisan queue:work --queue=mailgun-emails --sleep=3 --tries=3
autostart=true
autorestart=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/path/to/your/app/storage/logs/mailgun-emails.log
```

Usage
-----

[](#usage)

### Email Templates

[](#email-templates)

Create an email template:

```
use Inbounder\Models\EmailTemplate;

$template = EmailTemplate::create([
    'name' => 'Welcome Email',
    'slug' => 'welcome-email',
    'subject' => 'Welcome to {{company}}!',
    'html_content' => 'Welcome {{name}}!Thank you for joining {{company}}.',
    'text_content' => 'Welcome {{name}}! Thank you for joining {{company}}.',
    'variables' => ['name', 'company'],
    'is_active' => true,
]);
```

Send a templated email:

```
use Inbounder\Services\TemplatedEmailJobDispatcher;

$dispatcher = app(TemplatedEmailJobDispatcher::class);

// Send to one recipient
$dispatcher->sendToOne(
    'user@example.com',
    'welcome-email',
    ['name' => 'John Doe', 'company' => 'Acme Corp']
);

// Send to multiple recipients
$recipients = [
    ['email' => 'user1@example.com', 'name' => 'John', 'company' => 'Acme'],
    ['email' => 'user2@example.com', 'name' => 'Jane', 'company' => 'Acme'],
];

$dispatcher->sendToMany($recipients, 'welcome-email');

// Send as a batch
$batch = $dispatcher->sendBatch($recipients, 'welcome-email');
```

### Distribution Lists

[](#distribution-lists)

Create a distribution list:

```
use Inbounder\Models\DistributionList;

$list = DistributionList::create([
    'name' => 'Newsletter Subscribers',
    'slug' => 'newsletter-subscribers',
    'description' => 'Monthly newsletter subscribers',
    'category' => 'newsletter',
    'is_active' => true,
]);
```

Add subscribers:

```
use Inbounder\Services\DistributionListService;

$service = app(DistributionListService::class);

$service->addSubscribers($list->id, [
    ['email' => 'user1@example.com', 'name' => 'John Doe'],
    ['email' => 'user2@example.com', 'name' => 'Jane Smith'],
]);
```

Send to distribution list:

```
$service->sendCampaign($list->id, 'newsletter-template', [
    'month' => 'January',
    'year' => '2024',
]);
```

### Webhook Handling

[](#webhook-handling)

Set up webhook routes in your `routes/web.php`:

```
Route::post('/mailgun/webhook', [MailgunController::class, 'webhook'])
    ->middleware('verify.mailgun.webhook');

Route::post('/mailgun/inbound', [MailgunController::class, 'inbound'])
    ->middleware('verify.mailgun.webhook');
```

### Authorization

[](#authorization)

Configure authorization in your `config/inbounder.php`:

```
'authorization' => [
    'method' => 'gate', // 'gate', 'policy', or 'spatie'
    'gate_name' => 'send-email',
    'policy_method' => 'sendEmail',
    'spatie_permission' => 'send email',
],
```

Define your authorization logic:

```
// Using Gates
Gate::define('send-email', function ($user) {
    return $user->hasPermission('send-email');
});

// Using Policies
class UserPolicy
{
    public function sendEmail(User $user): bool
    {
        return $user->hasPermission('send-email');
    }
}

// Using Spatie Permissions
$user->givePermissionTo('send email');
```

### Events

[](#events)

Listen to package events:

```
use Inbounder\Events\EmailTemplateCreated;
use Inbounder\Events\DistributionListCreated;

Event::listen(EmailTemplateCreated::class, function ($event) {
    Log::info('Email template created', [
        'template_id' => $event->getTemplateId(),
        'template_name' => $event->getTemplateName(),
    ]);
});

Event::listen(DistributionListCreated::class, function ($event) {
    Log::info('Distribution list created', [
        'list_id' => $event->getListId(),
        'list_name' => $event->getListName(),
    ]);
});
```

Console Commands
----------------

[](#console-commands)

### Email Templates

[](#email-templates-1)

```
# Create a template
php artisan inbounder:templates:create

# List templates
php artisan inbounder:templates:list

# Send a templated email
php artisan inbounder:templates:send
```

### Distribution Lists

[](#distribution-lists-1)

```
# Create a distribution list
php artisan inbounder:lists:create

# List distribution lists
php artisan inbounder:lists:list

# Add subscribers
php artisan inbounder:lists:add-subscribers

# Remove subscribers
php artisan inbounder:lists:remove-subscribers

# Send campaign
php artisan inbounder:lists:send-campaign
```

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

The package includes comprehensive tests with high coverage for all components.

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

[](#contributing)

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests
5. Submit a pull request

License
-------

[](#license)

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

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance54

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

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

Total

106

Last Release

320d ago

PHP version history (2 changes)v0.1.0PHP ^8.1

v0.3.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/bee8d0a3a7ed351b1b7617c1005dabcdd7c6b7587eed32ae80a4939064327d2e?d=identicon)[dchurch](/maintainers/dchurch)

---

Top Contributors

[![jdc1898](https://avatars.githubusercontent.com/u/3174628?v=4)](https://github.com/jdc1898 "jdc1898 (101 commits)")

---

Tags

laravelmailemailqueuetemplateswebhooksmailgundistribution-lists

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/fullstack-inbounder/health.svg)

```
[![Health](https://phpackages.com/badges/fullstack-inbounder/health.svg)](https://phpackages.com/packages/fullstack-inbounder)
```

###  Alternatives

[typicms/base

A modular multilingual CMS built with Laravel, enabling developers to manage structured content like pages, news, events, and more.

1.6k20.3k](/packages/typicms-base)[juanparati/sendinblue

A Sendinblue v3 interface provider for Laravel

20269.6k](/packages/juanparati-sendinblue)[juanparati/brevosuite

Complete Brevo integration with Laravel

1010.8k](/packages/juanparati-brevosuite)

PHPackages © 2026

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