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.
$resend->emails->send()) integrates seamlessly with Laravel’s Eloquent, Queues, and Mailable classes.webhooks API) allows integration with Laravel’s queue:work and event listeners for async processing (e.g., tracking opens/clicks).Mail facade for transactional emails, reducing boilerplate.queue:failed table for retry logic (via Resend’s idempotency keys).throttle middleware).Mail facade for transactional emails (e.g., Auth::passwords()->sendResetLink()).resend/resend-php in App\Services\EmailService for consistency.queue:work for async sends (Resend’s API is rate-limited).Resend::client() in CLI scripts or non-Laravel services.MailFake for unit tests; mock Resend’s API in integration tests.Mail::send() with $resend->emails->send() for critical flows (password resets, receipts).queue:work (e.g., UserObserver).email.opened → update user_last_active).text/html payloads directly.SendEmailJob for retries.| Step | Priority | Effort | Dependencies |
|---|---|---|---|
| Install SDK | High | Low | Composer access |
Replace Mail |
High | Medium | API key, basic templates |
| Queue Integration | Medium | High | Laravel queues, retry logic |
| Webhook Setup | Low | Medium | Event listeners, validation |
| Contact Sync | Low | High | Data migration, GDPR compliance |
mail event listeners).Log::error() to capture Resend API failures (e.g., rate limits).ResendService facade to abstract API calls.invalid_to_address).try-catch blocks to handle Resend\Exceptions\ResendException.batch API for >100 emails (reduces API calls).Cache::remember()).| Scenario | Impact | Mitigation |
|---|---|---|
| Resend API Outage | Emails not sent | Fallback to SES + local queue |
| Rate Limiting | Throttled requests | Exponential backoff + queue delays |
| Invalid API Key | All requests fail | Environment variable validation |
| Template Rendering Error | Broken emails | Validate templates in CI |
| Webhook Signature Fail | Missed events | Retry failed webhook deliveries |
How can I help you explore Laravel packages today?