Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Resend Php Laravel Package

resend/resend-php

Official Resend PHP SDK (PHP 8.1+) for sending emails via the Resend API. Install with Composer, create a client with your API key, and send emails with a simple emails->send() call. Inspired by openai-php.

View on GitHub
Deep Wiki
Context7

resend/resend-php is a lightweight PHP 8.1+ client for the Resend API, designed to make sending transactional emails straightforward and type-safe. Install via Composer, create a client with your API key, and send emails using a clean, fluent interface.

Built for modern PHP projects (including Laravel), it provides a simple wrapper around Resend endpoints while keeping your integration minimal and maintainable.

  • Easy setup with composer require resend/resend-php
  • Send emails with from, to, subject, and text payloads
  • Client-based API (Resend::client(...)) with organized resources (e.g., emails)
  • Modern PHP support (PHP 8.1+)
  • Tested and inspired by the ergonomics of OpenAI PHP
Frequently asked questions about Resend Php
How do I integrate resend/resend-php with Laravel’s Mail facade for transactional emails?
Replace `Mail::send()` with `$resend->emails->send()` in your Laravel app. For password resets, use the Resend API directly in your `ResetPasswordController` or wrap it in a service class. The SDK’s fluent interface mirrors Laravel’s Mailable patterns, so migration is straightforward. Start with critical flows like auth emails before expanding to other use cases.
Does resend/resend-php support Laravel queues for async email sending?
Yes, wrap Resend calls in a `SendEmailJob` and dispatch it via Laravel’s queue system. This handles retries and rate limits automatically. Use Resend’s idempotency keys to prevent duplicate sends if jobs fail. For production, configure `queue:failed` table to retry failed jobs with a fallback SMTP if Resend is unavailable.
What Laravel versions and PHP requirements does resend/resend-php support?
The package requires **PHP 8.1+** and is tested with **Laravel 9+**. It avoids global overrides, so it won’t conflict with Laravel’s core. For older Laravel versions (8.x), check the GitHub issues for compatibility patches, but the SDK is designed for modern PHP features like named arguments and enums.
How do I handle email templates in Laravel if I’m migrating from Blade to Resend?
Replace Blade templates with Resend’s **templates API**. Use dynamic template variables (e.g., `{{user.name}}`) to mirror your existing Blade logic. For complex layouts, pre-render Blade templates in a service layer and pass the HTML to Resend’s `html` payload. The Laravel example repo shows how to sync templates between Blade and Resend.
Can I use resend/resend-php for newsletters or is it only for transactional emails?
While optimized for transactional emails, the SDK supports Resend’s **broadcasts API** for newsletters. Use `$resend->emails->sendMany()` for bulk sends, but note Resend’s free tier limits (1,000 emails/month). For high-volume newsletters, consider Resend’s paid plans or integrate with Laravel’s queue system to batch sends and avoid throttling.
How do I test resend/resend-php in Laravel without hitting Resend’s API?
Use Laravel’s `MailFake` for unit tests to mock email sends. For integration tests, mock the Resend client with PHPUnit’s `createMock()` or use a testing API key from Resend’s sandbox environment. The SDK’s clean interface makes it easy to swap implementations for testing. Example test cases are in the [Laravel example repo](https://github.com/resend/resend-laravel-example).
What happens if Resend’s API goes down? Can I fallback to another SMTP service?
Implement a fallback by catching exceptions (e.g., `ResendException`) and retrying with a secondary SMTP like Amazon SES or Mailgun. Wrap Resend calls in a service class with a `try-catch` block and queue the fallback job. Monitor Resend’s [status page](https://resend.com/status) and set up Laravel’s `queue:failed` table to log issues for manual review.
Does resend/resend-php support webhooks for tracking email opens/clicks?
Yes, use Resend’s **webhooks API** to listen for events like `email.opened` or `email.click`. In Laravel, route webhooks to a controller and dispatch events (e.g., `EmailOpened`) or update user models via observers. The SDK provides a `webhooks` resource to manage subscriptions. For async processing, use Laravel’s queue system to avoid blocking requests.
How do I migrate existing Laravel contacts to Resend’s contacts API?
Sync users to Resend’s contacts API using Laravel’s `UserObserver` or a queue job. For GDPR compliance, include an `unsubscribed` field and provide an opt-out link in emails. Use Resend’s `contacts->upsert()` method to batch updates. The migration should be idempotent—re-running it shouldn’t duplicate contacts. Test with a small subset before full deployment.
Are there alternatives to resend/resend-php for Laravel, and when should I choose them?
Alternatives include **Laravel’s built-in Mail facade** (for SMTP) or third-party SDKs like **Mailgun’s PHP SDK** or **SendGrid’s laravel-sendgrid-driver**. Choose Resend if you want a modern, API-driven solution with no SMTP setup. Use SMTP alternatives if you need self-hosted control, lower costs at scale (>100K emails/month), or advanced deliverability tuning. Resend excels for startups and transactional emails with minimal boilerplate.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport