trycourier/courier

Courier PHP SDK

Installs: 630 586

Dependents: 0

Suggesters: 0

Security: 0

Stars: 15

Watchers: 16

Forks: 7

Open Issues: 1

pkg:composer/trycourier/courier


README

Courier PHP SDK

Beta: The PHP SDK is in beta. APIs may change between releases. Share feedback or report issues on GitHub.

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.

Installation

Add to your composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "git@github.com:trycourier/courier-php.git"
    }
  ],
  "require": {
    "trycourier/courier": "dev-main"
  }
}

Then run composer install.

Quick Start

<?php

use Courier\Client;

$client = new Client(apiKey: getenv('COURIER_API_KEY'));

$response = $client->send->message(
  message: [
    'to' => ['email' => 'you@example.com'],
    'content' => [
      'title' => 'Hello from Courier!',
      'body' => 'Your first notification, sent with the PHP SDK.',
    ],
  ],
);

var_dump($response->requestId);

The client reads your API key from the constructor argument. Set COURIER_API_KEY in your environment and pass it with getenv('COURIER_API_KEY').

Documentation

Full documentation: courier.com/docs/sdk-libraries/php