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

Resend PHP is an official PHP 8.1+ client for the Resend email API. Install via Composer and send transactional emails with a clean, simple interface (e.g., $resend->emails->send) in PHP or Laravel.

View on GitHub
Deep Wiki
Context7

Resend's Official PHP SDK

Frequently asked questions about Resend Php
How do I integrate Resend PHP with Laravel’s Mail facade for hybrid email sending?
You’ll need to create a custom mailer class extending Laravel’s `Mailable` or `Mailer` and delegate calls to the Resend SDK. For example, override the `send()` method to use `Resend::emails->send()` while preserving Laravel’s queue and logging systems. Conflicts like `from` address validation can be resolved by validating against Resend’s API rules before sending.
Does Resend PHP support Laravel’s queue system for async email delivery?
Yes, the SDK supports async operations. Wrap `Resend::emails->send()` in a Laravel job (e.g., `SendResendEmail`) and dispatch it via `dispatch(new SendResendEmail($data))`. This leverages Laravel’s queue workers (database, Redis, etc.) for background processing, just like native mailables.
Can I use Resend templates alongside Laravel’s Blade/Markdown emails?
Absolutely. You can map Resend template IDs to Laravel’s email views or use Resend’s dynamic templates for hybrid workflows. For example, store template IDs in config (`resend.templates.welcome`) and reference them in your Laravel mailables. Blade/Markdown emails can still be sent via Laravel’s `Mailable` while using Resend for transactional templates.
How do I handle Resend webhooks in Laravel (e.g., for email delivery events)?
Create a `ResendWebhookController` to receive webhooks at a route like `/resend/webhook`. Parse the payload and dispatch Laravel events (e.g., `ResendEmailDelivered`) or update models via observers. Use middleware to validate signatures (`X-Resend-Signature`). For event-driven workflows, bind a service to handle translations between Resend events and Laravel’s event system.
What Laravel versions does Resend PHP officially support?
The SDK requires PHP 8.1+ and is tested with Laravel 8.x–10.x. While it lacks Laravel-specific abstractions, its modular design allows integration with any Laravel LTS version. For older versions (e.g., 7.x), you’d need to polyfill PHP 8.1 features like typed properties or enums manually.
How do I sync Laravel users/models with Resend contacts/audiences?
Create a `ResendContactable` trait or service to map Laravel models (e.g., `User`) to Resend contacts. Use `Resend::contacts->upsert()` in model observers (e.g., `created()`) or a queue job. For audiences, batch sync via `Resend::contacts->upsertMany()` during user imports or nightly cron jobs. Store Resend contact IDs in a `resend_contact_id` column on your models.
Is there a fallback mechanism if Resend’s API fails (e.g., rate limits or outages)?
Implement a fallback by catching `ResendException` and retrying with exponential backoff or switching to Laravel’s default mailer (e.g., SES, Mailgun). Use Laravel’s `retry()` helper or a custom `ResendFallbackService` to log failures and route emails to a backup system. Configure this in `AppServiceProvider` with conditional bindings.
How do I log Resend email delivery events to Laravel’s Monolog system?
Extend the SDK’s logging by wrapping `Resend::emails->send()` in a custom service. Use `Log::channel('resend')->info()` to record events like `email.sent` or `email.failed`. For webhook events, log payloads via `Log::debug()` with a `resend.webhook` channel. Configure channels in `config/logging.php` to route logs to your preferred handler (e.g., Slack, database).
Are there performance considerations for batch operations (e.g., upserting contacts)?
Batch operations like `Resend::contacts->upsertMany()` can impact Laravel’s request lifecycle. Offload these to queue jobs or console commands (e.g., `php artisan resend:sync-contacts`). Monitor API rate limits (Resend’s default is 100 requests/second) and implement chunking (e.g., 50 contacts per batch) to avoid throttling. Benchmark under load using Laravel’s `Benchmark` facade.
What alternatives exist for sending emails in Laravel, and why choose Resend PHP?
Alternatives include `laravel-notification-center` (for notifications), `spatie/laravel-mailables` (for reusable mailables), or direct API clients like `guzzlehttp/guzzle` with Resend’s API. Choose Resend PHP for its official support, modern PHP 8.1+ features, and full API parity (e.g., templates, automations). Unlike Laravel-specific packages, it offers direct access to Resend’s advanced features without abstraction overhead.
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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony