drewlabs / envoyer-aws
AWS SES and Pinpoint drivers for envoyer library
v0.2.0
2023-06-12 08:36 UTC
Requires
- php: >=7.0
- aws/aws-sdk-php: ^3.2
- drewlabs/envoyer-contracts: ^0.2.0
Requires (Dev)
- drewlabs/envoyer: ^0.2.0
- phpunit/phpunit: >=6.0
This package is auto-updated.
Last update: 2024-11-12 13:03:44 UTC
README
The library provides envoyer client
drivers/adapters for AWS SES
, AWS Pinpoint
services.
A SESAdapter
is provided by the library as interface to AWS Simple Email Service
API while, a PinpointMessageAdapter
is provided as interface for Short Message Service
.
Usage
- AWS SES adapter
use Drewlabs\Envoyer\Drivers\Aws\SESAdapter; use Drewlabs\Envoyer\Drivers\Aws\Utils\CredentialsFactory; use Drewlabs\Envoyer\Mail; $config = require __DIR__ . '/config.php'; // Build email $mail = Mail::new() ->from($config['email'], 'SERVICES') ->to('...') ->subject('...') ->content('...'); // Create mail adapter $adapter = SESAdapter::new([ 'region' => $config['region'], // Creates a promise object for aws credentials 'credentials' => CredentialsFactory::create($config['user'], $config['password']) ]); // Send mail request $result = $adapter->sendRequest($mail);