Download the PHP package myth/courier without Composer

On this page you can find all versions of the php package myth/courier. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package courier

myth/courier

Email campaigns and drip sequences for CodeIgniter 4.

Full documentation →

Requirements

Installation

Run the package migrations:

Register tracking routes

The package ships a Config/Routes.php that registers the tracking endpoints automatically via CI4's module discovery. Enable it by adding 'routes' to your app/Config/Modules.php:

That's it — the following routes are then available with no further configuration:

Route Purpose
GET /courier/open/{token} Open-tracking pixel (returns 1×1 GIF)
GET /courier/click/{token} Click redirect (tracks click, redirects to target URL)
GET /courier/unsubscribe/{token} One-click unsubscribe
POST /courier/capture Signup form capture (used by courier_form())

Custom prefix or manual control: If you want a different URL prefix or to disable the routes entirely, keep 'routes' out of $aliases and add the group yourself in app/Config/Routes.php:

Configuration

Publish the config file:

Edit app/Config/Courier.php:

Property Type Default Description
$fromName string '' Default sender display name
$fromEmail string '' Default sender address
$defaultLayout string bundled default CI4 view path for the email wrapper layout
$trackingHost string '' Custom tracking domain (e.g. https://track.yoursite.com); leave empty to use base_url()
$batchSize int 200 Max emails sent per CLI run
$throttleMs int 0 Milliseconds to sleep between individual sends (0 = no throttle)
$testMode bool false When true, logs emails instead of sending them

Quick Start

Subscribe a contact

Send a blast campaign

Set up a drip sequence

Segmentation

Courier supports two audience targeting strategies.

Tag filtering

Tag-filter campaigns send to all contacts who have ALL of the specified tags:

Segment rules

Segments let you save reusable audience definitions. The rules column is a JSON array of conditions matched against contact fields:

match_mode controls whether all rules must match (AND) or any rule may match (OR).

Create segments via SegmentService:

Template Authoring

Email templates are standard CI4 views. The view path is stored on each campaign or drip step and resolved via TemplateService::render().

Available variables

Inside a campaign body view:

Variable Description
$contact ContactDTO — email, first_name, last_name, custom_fields, etc.
$campaign CampaignDTO — name, subject, from_name, from_email
$unsubscribeUrl Pre-generated one-click unsubscribe URL

Inside a layout view:

Variable Description
$content The rendered body view HTML
$contact Same ContactDTO as above
$campaign Same CampaignDTO as above
$unsubscribeUrl One-click unsubscribe URL

Example body view

Bundled views

The package ships with example templates under src/Views/courier/emails/ and a default layout under src/Views/courier/layouts/default.php. Copy and adapt them as starting points.

Tracking

The three tracking endpoints are registered under the /courier/ route group. Routes are auto-discoverable — see Register tracking routes for setup.

Endpoint Behavior
GET /courier/open/{token} Records an open event; returns a 1×1 transparent GIF. Always returns the GIF — never 404 — so broken pixels stay silent in email clients.
GET /courier/click/{token}?url={encoded-url} Records a click event (stores URL + client IP) and redirects to the target URL. Validates that the URL starts with http:// or https:// to prevent open-redirect abuse.
GET /courier/unsubscribe/{token} Calls ContactService::unsubscribeByToken() and renders a confirmation page. Returns 404 for unknown tokens.

Click tracking is injected automatically when MailerService sends: every href in the email body is rewritten through the click endpoint.

The unsubscribe URL is injected as the $unsubscribeUrl template variable automatically.

Scheduled Tasks

Run these on a cron schedule to process campaigns and drip steps automatically.

Command What it does Recommended schedule
courier:send-campaign Sends all blast campaigns that are in scheduled status and past their scheduled_at time. Accepts an optional campaign ID to process a single campaign. Every minute
courier:process-drips Sends one batch of due drip steps ($batchSize emails). Every minute
courier:track-events Stub for processing bounce webhooks or SMTP feedback loops. Does nothing by default — extend to add real handling. As needed

Example crontab:

Extending — Bounce Webhook Handler

To process bounces from your email provider's webhook, extend TrackEvents:

Project Structure

Running Tests

Code Quality

Docker

Documentation (MkDocs)

Docs live in docs/ and are built with Material for MkDocs.

License

MIT — see LICENSE.


All versions of courier with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
league/commonmark Version ^2.0
myth/postal Version ^1.0@beta
symfony/yaml Version ^7.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package myth/courier contains the following files

Loading the files please wait ...