NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages

Require the package with Composer. The service provider and the Campaigns facade alias are auto-discovered — no manual registration:

composer require roundly-consulting/campaigns-for-laravel

Companion packages

Composer also installs the packages Campaigns builds on — contacts-for-laravel, options-for-laravel and enums-for-laravel, plus package-toolkit-for-laravel. Their migrations are publish-only. The send defaults (sender, sending queue, channel) are read through options-for-laravel whenever a campaign is prepared and whenever a recipient job is built, so publish and run its migration. The contacts migration is what lets you address campaigns from contact records:

php artisan vendor:publish --tag="options-migrations"
php artisan vendor:publish --tag="contacts-migrations"
php artisan migrate

Config file

The config file is optional — every key has a default, and all but one are env-backed. Publish it only to override:

php artisan vendor:publish --tag="campaigns-config"

Campaign tables (optional)

The default in-memory store needs no tables of its own. Only the database store needs the campaigns and campaign_recipients tables. The migrations are never loaded automatically — publish them first, or a bare migrate won’t create them:

php artisan vendor:publish --tag="campaigns-migrations"
php artisan migrate

Job batches

Every campaign runs as a Laravel job batch, stored in the job_batches table. New Laravel 13 apps create it in the default jobs migration; if yours doesn’t have it, generate it:

php artisan make:queue-batches-table
php artisan migrate

Publish tags

  • campaigns-config — config/campaigns.php.
  • campaigns-migrations — create_campaigns_table, create_campaign_recipients_table and add_recipient_to_campaign_recipients_table, timestamped on publish in that order. Republishing reuses copies already published and adds only the missing files.

Upgrading to 2.1

2.1.0 adds model recipients. With the database store, set CAMPAIGNS_RECIPIENT_KEY_TYPE first if your recipient models use uuid or ulid keys, then publish and run the new migration:

# only if your recipient models use uuid or ulid keys — before migrating
CAMPAIGNS_RECIPIENT_KEY_TYPE=uuid

php artisan vendor:publish --tag="campaigns-migrations"   # adds the new migration only
php artisan migrate

It adds nullable recipient_type / recipient_id (indexed together) and meta (json) to campaign_recipients and makes reachable_at nullable; existing rows are unchanged. The in-memory store needs nothing, and jobs queued on 2.0 still run after the upgrade. CampaignRecipient::$reachableAt is now ?string — address-only code behaves as before, though static analysis may ask you to handle null.

Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

More ways to support, including crypto

By donating, you agree to our donation terms.

Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.