PHPackages                             bdempe18/laravel-campaign-monitor - 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. bdempe18/laravel-campaign-monitor

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

bdempe18/laravel-campaign-monitor
=================================

Send Campaign Monitor emails using Laravel’s built-in Mailable API.

v0.1.1(6mo ago)1185MITPHPPHP &gt;=8.2

Since Oct 31Pushed 4mo agoCompare

[ Source](https://github.com/bdempe18/laravel-campaign-monitor)[ Packagist](https://packagist.org/packages/bdempe18/laravel-campaign-monitor)[ RSS](/packages/bdempe18-laravel-campaign-monitor/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (5)Used By (0)

Laravel Campaign Monitor
========================

[](#laravel-campaign-monitor)

A Laravel package that lets you send transactional Campaign Monitor emails using Laravel's built-in Mailable API.

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

[](#requirements)

- PHP 8.1+
- Laravel 10+
- A Campaign Monitor account with API access

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

[](#installation)

> **Warning**This package is currently being submitted to Packagist. Until it's available, you'll need to install it via a Git repository in your `composer.json`.

Install the package via Composer:

```
composer require bdempe18/laravel-campaign-monitor
```

Publish the configuration file:

```
php artisan vendor:publish --tag=campaign-monitor
```

Add the campaign monitor mailable to your `config/mail.php`. The package naturally toggles the transport from smpt to live emails based on the environment. By default no live emails are sent outside of production.

```
# config/mail.php

'campaign-monitor' => [
    'transport' => 'campaign-monitor',
]
```

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

[](#configuration)

Add your Campaign Monitor API key to your `.env` file:

```
CAMPAIGN_MONITOR_API_KEY=your-api-key-here
```

Next, configure your Smart Email templates in `config/campaign-monitor.php`. The templates array should be organized by category with template names as keys and Smart Email IDs as values. The templates array supports deep nesting.

```
'templates' => [
    'welcome' => [
        'onboarding' => 'smart-email-id-123',
        'activation' => 'smart-email-id-456',
    ],
    'notifications' => [
        'order-confirmation' => 'smart-email-id-789',
        'shipping-update' => 'smart-email-id-012',
    ],
],
```

Usage
-----

[](#usage)

### Sending Emails

[](#sending-emails)

Create a new Campaign Monitor mailable instance and send it just like any other Laravel mail:

```
use CampaignMonitor\CampaignMonitor;
use CampaignMonitor\EmailTemplateManager;

$template = EmailTemplateManager::get('welcome.onboarding');

Mail::to('user@example.com')->send(
    new CampaignMonitor($template, [
        'name' => 'John Doe',
        'verification_link' => 'https://example.com/verify',
        // ... other template variables
    ])
);
```

The template path uses dot notation to match your configuration structure. So `'welcome.onboarding'` corresponds to the template defined at `templates.welcome.onboarding` in your config.

### Template Variables

[](#template-variables)

All variables you pass in the data array will be sent to Campaign Monitor and available in your Smart Email template. Make sure the variable names match what's defined in your Campaign Monitor template.

### Queue Support

[](#queue-support)

The `CampaignMonitor` mailable implements `ShouldQueue`, so you can use Laravel's queue system:

```
Mail::to('user@example.com')->queue(
    new CampaignMonitor($template, $data)
);
```

### Environment Behavior

[](#environment-behavior)

The package behaves differently depending on your environment:

- **Production**: Emails are sent through Campaign Monitor's API
- **Non-production**: Emails fall back to your configured SMTP mailer

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

[](#artisan-commands)

### Sync Templates

[](#sync-templates)

Fetch your Campaign Monitor templates and cache them locally as Blade views:

```
php artisan campaign-monitor:sync
```

This command will:

- Fetch all Smart Email templates from Campaign Monitor
- Save them as Blade views in `resources/views/emails/campaign-monitor/`
- Generate mock templates for templates managed in Email Builder

The template files are named using a slug format like `onboarding.blade.php` based on your configuration structure.

### List Templates

[](#list-templates)

View all configured templates. If you organize your templates through nested groups, can you filter by group.

```
php artisan campaign-monitor:list
```

### Show Template

[](#show-template)

Display details about a specific template:

```
php artisan campaign-monitor:show {template}
```

Template Views
--------------

[](#template-views)

When you sync templates, they're stored in `resources/views/emails/campaign-monitor/`. The package automatically looks for views matching your template name, and falls back to a default view if not found. if you locally use mailpit or a similar service, you will receive nicely outputted test emails that give a good representation of what the live email will look like.

Support
-------

[](#support)

If you run into any issues or have questions, please open an issue on GitHub.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance72

Regular maintenance activity

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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

Total

4

Last Release

182d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/29ab7f6c850775542e18f6e61ca788cf67c1dbfc78fabd011315915e112a22d4?d=identicon)[bdempe18](/maintainers/bdempe18)

---

Top Contributors

[![bdempe18](https://avatars.githubusercontent.com/u/10928740?v=4)](https://github.com/bdempe18 "bdempe18 (20 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bdempe18-laravel-campaign-monitor/health.svg)

```
[![Health](https://phpackages.com/badges/bdempe18-laravel-campaign-monitor/health.svg)](https://phpackages.com/packages/bdempe18-laravel-campaign-monitor)
```

###  Alternatives

[mckenziearts/laravel-notify

Flexible flash notifications for Laravel

1.7k1.1M5](/packages/mckenziearts-laravel-notify)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/apn

Apple APN Push Notification Channel

2021.9M4](/packages/laravel-notification-channels-apn)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[illuminate/mail

The Illuminate Mail package.

5910.1M391](/packages/illuminate-mail)

PHPackages © 2026

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