Announcing the PHP SDK

Now you can send emails using the official Resend SDK for PHP apps.

Jayan RatnaJayan Ratna

Providing the best developer experience is one of our main focuses at Resend. We believe the best way to integrate with Resend is using one of our many SDK's to interact with the REST API. Today, we are thrilled to announce the launch of our PHP SDK.

The story

It all started with a simple question: “How can I send emails when I’m using PHP?”. Resend already has a very simple API endpoint to send emails, so why not using that?

I thought creating a wrapper would allow me to use it for my other PHP apps and now we're sharing this package with everyone interested in integrating Resend with PHP.

Working with PHP

First, install the client via Composer:

composer require resend/resend-php

Then, interact with Resend's API:

$resend = Resend::client('re_123456789');

try {
    $result = $resend->sendEmail([
        'from' => '',
        'to' => '',
        'subject' => 'hello world',
        'text' => 'it works!',
        'html' => '<strong>it works!</strong>',
} catch (\Exception $e) {
    exit('Error: ' . $e->getMessage());

echo $result->toArray();

If you would like to learn more about the PHP SDK, check out the documentation.

You can also find the source code on GitHub.

Future plans

While the PHP SDK is ideal for a majority of PHP projects, we would like to take things further by adding support for popular PHP frameworks. In the background we’re working away at building Resend for Laravel, designed on top of the new PHP SDK to easily integrate with your application.

Here's the work-in-progress repository for Laravel, in case you're curious: