PHPackages                             flobbos/laravel-cm - 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. [API Development](/categories/api)
4. /
5. flobbos/laravel-cm

ActiveLibrary[API Development](/categories/api)

flobbos/laravel-cm
==================

Complete package for Campaign Monitor integration

6.2.2(1mo ago)51.6k↓90%1MITBladePHP ^8.2CI passing

Since Sep 24Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Flobbos/laravel-cm)[ Packagist](https://packagist.org/packages/flobbos/laravel-cm)[ RSS](/packages/flobbos-laravel-cm/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (14)Versions (53)Used By (0)

Laravel-CM
==========

[](#laravel-cm)

[![Laravel CM](img/laravel-cm.png)](img/laravel-cm.png)

**Integration for the v3.2 Campagin Monitor API**

This package allows you to generate templates using your own resources and submit them to Campaign Monitor as content for your newsletter issues. It comes complete with a CRUD implementation for saving your content templates in the DB.

**As of version 2.0.0 only [MJML](https://mjml.io/) will be accepted**

**Support for Laravel 8 was moved to version 3.x**

**Note on Tailwind Stubs:** The generated views using the Tailwind stubs incorporate JavaScript components that rely on Alpine.js for interactivity (e.g., dropdowns, modals, or dynamic elements). Make sure to include Alpine.js in your project's asset pipeline (via CDN or npm) to ensure these features work as expected. For setup, refer to the [Alpine.js documentation](https://alpinejs.dev/).

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

[](#requirements)

- **PHP**: ^8.2
- **Laravel**: ^11.0 | ^12.0 | ^13.0
- **Composer Dependencies**:
    - `guzzlehttp/guzzle` ^7.0 (for handling API requests)
    - `maatwebsite/excel` ^3.1 (for subscriber imports and exports)
- **Campaign Monitor**: An active account with API key and client ID configured in your `.env` file.
- **Frontend (Optional)**: If generating views with the Tailwind stubs (via `laravel-cm:views-templates --tailwind`), include Alpine.js in your asset pipeline as mentioned above.

### Docs

[](#docs)

- [Upgrading](#upgrading)
- [Installation](#installation)
- [Configuration](#configuration)
- [Assets](#assets)
- [Generators](#generators)
- [Usage](#usage)
- [Exceptions](#exceptions)
- [Laravel compatibility](#laravel-compatibility)
- [Envoyer deployments](#envoyer-deployments)

Upgrading
---------

[](#upgrading)

### Upgrade from Version 1.x to Version 2.x

[](#upgrade-from-version-1x-to-version-2x)

If you have previously used LaravelCM you need to follow a few steps to make your setup compatible with the new version of LaravelCM.

### Base Layout/Template

[](#base-layouttemplate)

Since LaravelCM now offers a multi-layout solution we updated the nomenclature of the files as well as the directory structure. You need to copy your existing template images and SCSS to the newly created files.

```
../storage/app/laravel-cm/layouts/base
```

Move all your template code to base.blade.php and all your SCSS to base.scss. These should no longer be located in an 'assets' folder. Images are copied to the 'images' folder in the base layout root directory.

### Migrating the config

[](#migrating-the-config)

LaravelCM 2.x provides a lot of new configuration variables that you need to set in order to get everything working. If you navigate to the dashboard of LaravelCM you will notice the new configuration options in the listing there. It is probably your best bet to delete your current configuration file and republish it from scratch.

### Migration for multi layout option

[](#migration-for-multi-layout-option)

If you plan on using multiple layouts for your newsletters you need to add a field 'layouts' to your newsletter templates table so LaravelCM can keep track of this information.

Your migration should look something like this:

```
Schema::table('newsletter_templates', function(Blueprint $table){
    $table->string('layout')->nullable();
});
```

Once that field is added to your template model as well, you should be good to go, after running the install command below to move the content to the appropriate locations.

### Install Command

[](#install-command)

LaravelCM 2.x features a new install command that takes care of publishing the config files and such. You can also run this during deployments to make sure required directories exist and legacy files are migrated to the current directory structure.

```
php artisan laravel-cm:install --deployment
```

This command keeps layouts in `resources/laravel-cm/layouts` (repository-managed) and stores generated template source files in storage (default: `storage/app/laravel-cm/templates`). Existing files are synced in a non-destructive way so already existing files are preserved.

### Upgrade from Version 2.x to Version 3.x

[](#upgrade-from-version-2x-to-version-3x)

If you have previously used LaravelCM you need to follow a few steps to make your setup compatible with the new version of LaravelCM.

### Migrating the config

[](#migrating-the-config-1)

LaravelCM 3.x changed the option 'bootstrap' to 'css\_framework' in the config because you can now switch between Bootstrap4 and TailwindCSS.

### Routes Facade

[](#routes-facade)

Since Laravel 8 handles routes a bit differently than previous versions you need to provide the namespace of the NewsletterTemplateController generated via command to the CMRoutes facade like mentioned below.

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

[](#installation)

### Install package

[](#install-package)

Add the package in your composer.json by executing the command.

```
composer require flobbos/laravel-cm
```

LaravelCM features auto discover for Laravel. In case this fails, just add the Service Provider to the app.php file.

```
Flobbos\LaravelCM\LaravelCMServiceProvider::class,

```

### Running the installation routine

[](#running-the-installation-routine)

Using the new install command you are guided through the process of publishing all necessary files as well as set up all required directories and symlinks.

```
php artisan laravel-cm:install
```

Follow the step by step process or alternatively you can just run everything at once. There is a prompt for that option.

### Publish configuration file

[](#publish-configuration-file)

This step is very important because it publishes the NewsletterTemplate model to the App folder so you can set your own fillable fields as well as relationships you may need. The template generator needs to have this model present otherwise you will receive an error.

This also publishes the inital base layout that will be used to generate newsletter templates.

```
php artisan vendor:publish --tag=laravel-cm-config
```

### Generate Controller

[](#generate-controller)

You need to generate the controller that handles generating the templates from the base layout or any other layout you generated.

```
php artisan laravel-cm:controller NewsletterTemplateController --route=
```

You can give this command a route that will be used but you will also be asked for it during generation. This route is where all the magic happens. The default is admin.newsletter-template.

### Generate Views

[](#generate-views)

Next up are the views you need for running your template generation

```
php artisan laravel-cm:views path.to.routes --route=
```

Here you need to use the route previously defined for your controller. The default is the same but you will also be asked during the generation process.

### Migrations

[](#migrations)

During the publishing process the migration for the newsletter\_templates table was also published. Add all fields you need and run the migration.

```
php artisan migrate
```

### Adding the package

[](#adding-the-package)

### Routes

[](#routes)

Routes that are used by LaravelCM need to be added to your routes file. Since version 3.x you need to specify the namespace of the NewsletterTemplateController generated from LaravelCM.

```
use App\Http\Controllers\NewsletterTemplateController;

CMRoutes::load(NewsletterTemplateController::class);
```

This is all you need to do for the routes to load.

If you want to add the routes to your NewsletterTemplateController manually you can simply add the following routes:

```
Route::put('newsletter-template/generate-template/{id}', [NewsletterTemplateController::class, 'generateTemplate'])->name('newsletter-templates.generate-template');
Route::put('newsletter-template/update-template/{id}', [NewsletterTemplateController::class, 'updateTemplate'])->name('newsletter-templates.update-template');
Route::get('templates/{id}/send-preview', [NewsletterTemplateController::class, 'sendPreview'])->name('newsletter-templates.send-preview');
Route::resource('newsletter-templates', NewsletterTemplateController::class)
```

### Menu items

[](#menu-items)

If you're using a standard Boostrap4 or Tailwind top bar menu you can simply include all necessary links with a dropdown like so:

```
@include('laravel-cm::menu')
```

In your main layout blade file or where ever your top bar is located.

### Tailwind responsive menu

[](#tailwind-responsive-menu)

Since the switch to Tailwind the default Laravel menu has a responsive menu. Just include the provided menu where the rest of the responsive Laravel menu is located.

```
@include('laravel-cm::menu-responsive')
```

That's it. You're ready to roll. Let's move on to the configuration

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

[](#configuration)

### Client API Key

[](#client-api-key)

Set your Campaign Monitor client API key here to have access to the API.

```
'client_api_key' => 'your secret key'
```

### Client ID

[](#client-id)

Set your Campaign Monitor client ID.

```
'client_id' => 'your client ID'
```

### Default list ID

[](#default-list-id)

If you have created a list at Campaign Monitor you can set a default list. If not you can create a list using the API and insert it here later.

```
'default_list_id' => 'your default list ID'
```

### Base URI

[](#base-uri)

This is the base URI where the Campaign Monitor API is being called. This might change in the future with new releases of their API. For now, don't touch it.

```
'base_uri' => 'https://api.createsend.com/api/v3.2/'
```

### Storage path

[](#storage-path)

If you plan on importing XLS files with email addresses this determines the storage path used for it.

```
'storage_path' => 'xls'
```

### URL Path

[](#url-path)

Determine the base route for the package.

```
'url_path'=>'laravel-cm'
```

### Format

[](#format)

Here you can set the default format being used to communicate with the API. For the moment only JSON is supported.

```
'format' => 'json'
```

### Confirmation emails

[](#confirmation-emails)

By default you can have a list of up to 5 email addresses in a comma separated list where confirmations will be sent when a campaign is sent.

```
'confirmation_emails' => 'you@example.com,xyz@example.com',
```

### Subscribe success

[](#subscribe-success)

If you're using the same success page for subscriptions every time then you can set it here so it will be automatically loaded into the forms.

```
'subscribe_success' => 'http://example.com/success'
```

### Unsubscribe success

[](#unsubscribe-success)

Same goes for unsubscribe success page.

```
'unsubscribe_success' => 'http://example.com/unsubscribe_success'
```

### From Email

[](#from-email)

Default sender email for campaigns. This can still be changed in the form.

```
'from_email' => 'newsletter@example.com'
```

### Reply-to Email

[](#reply-to-email)

Default reply-to email for campaigns. This can still be changed in the form.

```
'reply_to' => 'replies@example.com'
```

### Layout file

[](#layout-file)

This determines the name of the layout file the package views will extend.

```
'layout_file' => 'admin'
```

### Layout path

[](#layout-path)

This is the resources path where layouts are stored and loaded from.

```
'layout_path' => 'laravel-cm/layouts'
```

### Template location

[](#template-location)

Determines where template source files are stored. By default this is set to storage.

```
'template_location' => 'storage' // storage|resource
```

### Template storage path

[](#template-storage-path)

Storage path used for template source files when `template_location` is set to `storage`.

```
'template_storage_path' => 'app/laravel-cm/templates'
```

### Template path (legacy resource mode)

[](#template-path-legacy-resource-mode)

Resources path used when `template_location` is set to `resource`.

```
'template_path' => 'laravel-cm/templates'
```

### Max test emails

[](#max-test-emails)

Maximum number of preview test email addresses.

```
'max_test_emails' => 5
```

### Test email

[](#test-email)

Default email address where preview mails are being sent to.

```
'test_email' => 'tester@example.com'
```

### Test subject

[](#test-subject)

Default subject for preview emails

```
'test_subject' => 'Campaign Preview'
```

### Remote compiler

[](#remote-compiler)

All compiling is done via the remote compiler, which is offered free of charge for all users of this package. To use the remote compiler, you now need to provide a valid **Bearer Token** for authentication.

Contact me for a valid API key (Bearer Token) to handle your remote compiling needs based on MJML. Set the token here:

```
'api_token' => 'your-bearer-token',
```

**Note:**
The remote compiler now uses Bearer Token authentication instead of basic authentication. Make sure your API token is kept secure and never committed to version control.

### CSS Framework

[](#css-framework)

You can now select which CSS framework you want to use. You have the option of using Bootstrap4 or TailwindCSS. Depending on this selection LaravelCM will automatically load the appropriate views.

```
//bootstrap or tailwind
'css_framework' => 'tailwind',
```

Assets
------

[](#assets)

### Naming conventions

[](#naming-conventions)

A default layout file is provided for you to work with. Additional layout files can be generated depending on what you need. The folder structure is simple and as follows:

```
/resources
    /defaults
        /base
            base.blade.php
            base.scss
```

This folder will get copied into your resources folder and you should put your default layout design into these files. You can also add an images folder which will also get copied once a new template gets generated.

The default should only contain your base layout. Subsequent changes should be made to the files that have been generated for a particular newsletter template.

Generators
----------

[](#generators)

### Controller generator

[](#controller-generator)

With this command you can generate a boiler plate controller where you can grab your content and generate the templates used for your campaigns.

First parameter is the controller name. The route parameter tells the generator where the default routes for the views/controller should be and the views parameter tells the controller where the view path should be.

```
php artisan laravel-cm:controller NewsletterController --route=admin.newsletter-template --views=laravel-cm.templates
```

### Views generator

[](#views-generator)

This command generates the views needed for making templates to be used in your campaigns.

First parameter is the path where the views should be located at. Should match the path you gave to the controller command.

```
php artisan laravel-cm:views /view/path --route=laravel-cm.templates
```

### Layouts Generator

[](#layouts-generator)

You can generate a new layout by simply using the following command. This will generate a new blank layout file for you to edit.

```
php artisan laravel-cm:layout name-of-layout
```

Usage
-----

[](#usage)

### Dashboard

[](#dashboard)

The dashboard contains an overview of your config settings and a mini documentation on how to use the package.

### Campaigns

[](#campaigns)

The campaigns overview shows your draft/scheduled/sent campaigns that were retrieved from Campaign Monitor via API. Here you can create/schedule/preview your campaigns as well as view basic statistical information.

### Lists

[](#lists)

The lists section lets you create/edit different email lists that are synced to Campaign Monitor. Here you can also view basic statistical information about your list such as subscribes/unsubscribes/bounces.

### Subscribers

[](#subscribers)

Here you can view all your subscriber information across different lists that you can select. It also gives you the option to import large amounts of subscribers from and XLS file. The format should be:

```
EmailAddress    Name

```

Be careful if the subscribers are already confirmed and are imported into a double-opt-in list, they will all receive a confirmation email where they basically have to resubscribe.

You can also manually unsubscribe users as well as resubscribe them and view basic information about your subscribers.

Exceptions
----------

[](#exceptions)

### ConfigKeyNotSetException

[](#configkeynotsetexception)

This exception will be thrown if a configuration key is missing from your config file but is needed to perform a certain API call.

### TemplateNotFoundException

[](#templatenotfoundexception)

This exception happens when you try to use a template that doesn't physically exist.

Laravel compatibility
---------------------

[](#laravel-compatibility)

LaravelLaravelCM13.x&gt;=6.2.\*12.x&gt;6.1.\*11.x&gt;6.0.\*10.x&gt;5.0.\*9.x&gt;4.0.\*8.x&gt;3.0.\*7.x&gt;2.0.\*6.x&gt;2.0.\*5.8&gt;2.0.\*5.7&gt;2.0.\*5.6&gt;=1.0.0/2.0.05.5&gt;=1.0.0/2.0.05.4&gt;=1.0.05.3&gt;=1.0.0Lower versions of Laravel are not supported.

Envoyer deployments
-------------------

[](#envoyer-deployments)

If you're using Envoyer or something similar to deploy your code, there's a solution to keeping your existing templates and compiled newsletters. During the deployment all you need to do is run the following command:

```
php artisan laravel-cm:install --deployment
```

This will ensure required directories exist and perform a backward-compatible migration: layouts are kept in resources, templates are synced to storage, and existing files are not overwritten.

###  Health Score

59

—

FairBetter than 98% of packages

Maintenance94

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 81.3% 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 ~59 days

Recently: every ~18 days

Total

48

Last Release

33d ago

Major Versions

4.0.3 → 5.0.02023-04-04

5.0.0 → 6.0.02024-10-24

4.0.4 → 6.1.22025-09-28

4.0.5 → 5.0.12026-02-23

5.1.0 → 6.1.32026-03-20

PHP version history (8 changes)0.0.1PHP &gt;=7.0.0

1.0.4PHP &gt;=7.1.3

2.0.0PHP &gt;=7.2.5

2.0.4PHP &gt;=5.6.0

3.0.0PHP ^7.3|^8.0

4.0.0PHP ^8.0

5.0.0PHP ^8.1

6.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/74704c23d1a3ea66e1ddd18de4e90635ea4a2c28838e72ad49ba947694f7988e?d=identicon)[Flobbos](/maintainers/Flobbos)

---

Top Contributors

[![Flobbos](https://avatars.githubusercontent.com/u/21225457?v=4)](https://github.com/Flobbos "Flobbos (26 commits)")[![vanderb](https://avatars.githubusercontent.com/u/2151453?v=4)](https://github.com/vanderb "vanderb (4 commits)")[![s0nyc69](https://avatars.githubusercontent.com/u/56442170?v=4)](https://github.com/s0nyc69 "s0nyc69 (2 commits)")

---

Tags

laravelnewsletterCampaign Monitor

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/flobbos-laravel-cm/health.svg)

```
[![Health](https://phpackages.com/badges/flobbos-laravel-cm/health.svg)](https://phpackages.com/packages/flobbos-laravel-cm)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.0k](/packages/simplestats-io-laravel-client)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k20](/packages/fleetbase-core-api)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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