xsga / bbphp-emailsender-resend-adapter
A PHP email sender core library
Package info
github.com/xsga/BBPHP-EmailSender-Resend-Adapter
Type:project
pkg:composer/xsga/bbphp-emailsender-resend-adapter
Requires
- php: ^8.4
- psr/log: ^3.0
- resend/resend-php: ^1.1
- xsga/bbphp-emailsender-core: ^1.0
Requires (Dev)
- php-parallel-lint/php-console-highlighter: ^1.0
- php-parallel-lint/php-parallel-lint: ^1.4
- phpmd/phpmd: ^2.15
- squizlabs/php_codesniffer: ^4.0
- vimeo/psalm: ^6.14
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-29 16:43:30 UTC
README
This package provides a Resend implementation of the email sending contract defined by the BBPHP Email Sender core library. It allows applications to send transactional or notification emails through Resend without depending on provider-specific logic in the business layer.
Overview
The project exposes a concrete adapter named ResendEmailService, which implements the SendEmailService interface from xsga/bbphp-emailsender-core.
The adapter:
- sends emails through the Resend API
- accepts a standard
EmailDataDtoobject - logs success and failure events through PSR-3 logging
- throws a domain-level
SendEmailExceptionwhen the sending process fails
Requirements
- PHP 8.4 or newer
- Composer
- A valid Resend API key
- The core package
xsga/bbphp-emailsender-core
Installation
composer require xsga/bbphp-emailsender-resend-adapter
Usage
<?php use Psr\Log\NullLogger; use Xsga\BBPHP\EmailSender\Adapter\Resend\ResendEmailService; use Xsga\BBPHP\EmailSender\Core\Application\Dto\EmailDataDto; $emailData = new EmailDataDto(); $emailData->sender = 'noreply@my-domain.com'; $emailData->senderName = 'Support Team'; $emailData->recipients = ['customer@example.com']; $emailData->subject = 'Welcome to our platform'; $emailData->body = '<h1>Hello!</h1><p>Thank you for joining us.</p>'; $emailService = new ResendEmailService( new NullLogger(), 're_xxxxxxxxxxxxxxxxxxxxxxxxx' ); $emailService->send($emailData);
Email payload
The adapter builds the Resend payload using the fields required by the core DTO:
sendersenderNamerecipientssubjectbody
The message is sent as an HTML email using the Resend emails->send() call.
Error handling
If Resend returns a non-success status code or an exception is thrown during the request, the adapter logs the failure and raises SendEmailException so the calling code can handle it consistently.
License
This project is licensed under the MIT License.
Author
Parker
Repository
- GitHub: https://github.com/xsga/BBPHP-EmailSender-Resend-Adapter
- Composer package:
xsga/bbphp-emailsender-resend-adapter