Resend PHP
The official PHP SDK for the Resend email API — send, schedule, and manage transactional email.
Repository Health
Technical Analysis
Resend PHP is the official PHP client library for Resend, the email API for developers. It wraps the entire Resend REST API behind a fluent, strongly-typed interface so you can send transactional and broadcast email, manage domains and API keys, and work with audiences, contacts, and webhooks without writing raw HTTP calls.
Built for PHP 8.1+ and inspired by the OpenAI PHP client, the SDK exposes each API resource as a service accessed through a single client instance, handling authentication, request construction, JSON serialization, and error handling for you. It ships with first-class support for attachments, scheduled sends, batch delivery, and webhook signature verification.
What You Get
- A fully typed PHP 8.1+ client covering every Resend API resource (emails, domains, API keys, audiences, contacts, broadcasts, templates, webhooks, and more)
- Fluent service access via a single client instance, e.g.
$resend->emails->send([...]) - Built-in helpers for attachments, scheduled sends, batch email delivery, and inbound/receiving email
- Webhook signature verification to validate incoming Resend event payloads
- Structured exceptions and a Guzzle-based HTTP transport with clear error handling
Common Use Cases
- Sending transactional email such as password resets, receipts, and account notifications from a PHP backend
- Delivering large batches or scheduled campaigns and broadcasts to managed audiences
- Programmatically managing sending domains, API keys, contacts, and audiences
- Verifying and processing Resend webhook events securely in your application
Under The Hood
Architecture — The SDK follows a clean layered design. The global Resend factory (src/Resend.php) builds an ApiKey, BaseUri, and Headers value object, wires them into an HttpTransporter over a Guzzle client, and returns a Client. Client (src/Client.php) uses PHP magic __get/__call to lazily resolve services through a ServiceFactory, so $resend->emails returns a Service\Email instance on demand. Each service method builds an immutable Payload value object (Payload::create, ::get, ::list, ::update, ::cancel), passes it to the transporter, and maps the decoded response into typed resource objects (Email, Domain, Collection, etc.) via a shared createResource helper.
Tech Stack — Pure PHP targeting ^8.1, with guzzlehttp/guzzle ^7.5 as the only runtime dependency. Autoloading is PSR-4 under the Resend\ namespace plus a bootstrap src/Resend.php file. Development tooling includes Pest (v1–v4), Mockery, and PHP-CS-Fixer, with configuration via phpunit.xml and .php-cs-fixer.php.
Code Quality — The codebase leans on modern PHP features: readonly promoted constructor properties, enums (Method, ContentType), contracts/interfaces for the client, transporter, and resources, and dedicated value objects for headers, URIs, and payloads. Error paths are explicit through a family of exceptions (ErrorException, TransporterException, UnserializableResponse, WebhookSignatureVerificationException). A comprehensive Pest test suite under tests/ covers services, transporters, value objects, and architecture rules.
API Design — The public surface is deliberately minimal and ergonomic: one Resend::client() entry point, service properties that read like the API documentation, and array-based parameters that mirror Resend’s REST payloads. Method names (send, get, list, update, cancel) are consistent across resources, and each is annotated with @see links to the corresponding API reference, keeping the learning curve low for developers already familiar with Resend.
Used by 2 apps in this directory
Fleetbase
Logistics
Modular open-source logistics and supply chain operating system
Pixelfed
Social Media
A decentralized, self-hosted photo sharing platform built on ActivityPub for the open Fediverse.