Search by

pulsesend / pulsesend-php

jiordiviera

PHP client for the PulseSend transactional email API.

Package info

github.com/useburoo/pulsesend-php

Homepage

pkg:composer/pulsesend/pulsesend-php

Statistics

Installs: 74

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.1 2026-11-16 11:14 UTC

This package is not auto-updated.

Last update: 2026-11-16 21:25:33 UTC


README

PHP client for the PulseSend transactional email API.

Using Laravel? Install pulsesend/pulsesend-laravel instead: it brings this client, a mail transport and webhook events.

Install

composer require pulsesend/pulsesend-php

Requires PHP 8.2 or later.

Send an email

$pulsesend = PulseSend\PulseSend::client('ps_live_xxxxxxxxx');

$email = $pulsesend->emails->send([
    'from' => 'Acme <hello@acme.com>',
    'to' => ['jane@example.com'],
    'subject' => 'Your login code',
    'html' => '<p>Your code is <strong>123456</strong></p>',
], ['idempotency_key' => 'otp-42']);

echo $email['id']; // em_...

Every part of the API is a property, or a method of the same name:

Service Calls
emails send, batch, get, list, update, reschedule, cancel
domains create, list, get, update, verify, remove
webhooks create, list, get, update, rotateSecret, test, remove
templates create, list, get, update, remove, publish, render, versions

Answers are the API's JSON, decoded into arrays.

Errors

An API error throws a subclass of PulseSend\Exception\ApiException, with the fields of the error object:

use PulseSend\Exception\ValidationException;

try {
    $pulsesend->emails->send([...]);
} catch (ValidationException $e) {
    $e->errorCode; // domain_not_verified
    $e->param;     // from
    $e->docUrl;    // link to the error's documentation
}

AuthenticationException, PermissionException, NotFoundException, ValidationException, InsufficientCreditsException, IdempotencyException and RateLimitException (with retryAfter) follow the error's type. A network failure throws ApiConnectionException.

Webhooks

use PulseSend\Webhook;

$event = Webhook::constructEvent(
    file_get_contents('php://input'),
    $_SERVER['HTTP_X_PULSESEND_SIGNATURE'] ?? null,
    'your_webhook_secret',
);

It throws SignatureVerificationException when the signature is missing, wrong or older than five minutes.

Options

PulseSend\PulseSend::client('ps_live_...', [
    'base_url' => 'https://pulse-send.jiordiviera.me',
    'timeout' => 30,
]);

License

MIT