Skip to main content
The Courier PHP SDK provides typed access to the Courier REST API from any PHP 8.1+ application. It uses named parameters for optional arguments and returns strongly typed response objects. Available on GitHub.
The PHP SDK is currently in beta. APIs may change between releases. Share feedback or report issues on GitHub.

Installation

Install from Packagist with Composer:
Requires PHP 8.1+. Find the latest version on Packagist.

Quick Start

Pass your API key via the COURIER_API_KEY environment variable or directly to the constructor: new Client(apiKey: 'your-key').

Authentication

Get your API key from Settings > API Keys in the Courier dashboard. Set it as an environment variable:
Or pass it to the client constructor:

Sending Notifications

With a template

With inline content

Available Resources

The SDK covers the full Courier API.

Common Operations

Checking Message Status

Managing User Profiles

Issuing JWT Tokens

Configuration

Error Handling

The SDK throws typed exceptions for API failures. All extend Courier\Core\Exceptions\APIException:

Retries

The SDK automatically retries failed requests up to 2 times with exponential backoff.

Journeys

Journeys are multi-step workflows (send, delay, branch, throttle, digest, and more). Invoke one by ID or alias to start a run, then cancel runs by ID or a shared cancelation token.
Cancel runs, and build and manage journeys (create, list, publish, archive), from code. When cancelling, pass exactly one of run_id or cancelation_token (spelled with one “l”). See Build journeys via API.

More Operations

The SDK covers the full Courier REST API. Here are a few more resources beyond what’s documented above:

API Reference

Full REST API docs with request/response examples.

Send API

Learn about the Send endpoint, routing, and message options.

Quickstart

Send your first notification in under two minutes.

GitHub

Source code, issues, and changelog.