peternijssen / ses-configuration
Package to manage SES configuration. It does not send actual emails!
Requires
- php: >=5.5
- aws/aws-sdk-php: ~3.14
Requires (Dev)
- phpunit/phpunit: ~4.8
- squizlabs/php_codesniffer: ~2.3
This package is not auto-updated.
Last update: 2020-08-21 20:26:37 UTC
README
Package to manage SES configuration. It does not send actual emails!
Install
Using Composer:
$ composer require peternijssen/ses-configuration
Testing
To run all unit tests, use the locally installed PHPUnit:
$ ./vendor/bin/phpunit
Usage
AWS SES Client
You have to begin with creating a SesClient
$sesClient = new \Aws\Ses\SesClient([
'region' => 'us-west-2',
'version' => 'latest',
'credentials' => [
'key' => 'key',
'secret' => 'secret',
],
]);
warning: It's not recommended to store your AWS credentials within the application itself. Please make sure your server has access through policies.
Identities
First you have to determine you are using an Email identity or Domain identity. You can then use the appropriate object;
$identity = new DomainIdentity("peternijssen.nl");
or
$identity = new EmailIdentity("peter@peternijssen.nl");
Manager
Next you have to use the correct manager;
$manager = new DomainManager($sesClient, $identity);
or
$manager = new EmailManager($sesClient, $identity);
From here, you can do several requests;
Create the new identity within SES
$manager->create();
Fetch the status (Pending|Success|Failed|TemporaryFailure|NotStarted)
$manager->fetchStatus();
Fetch the DKIM status (Pending|Success|Failed|TemporaryFailure|NotStarted)
$manager->fetchDkimStatus();
Fetch the DNS changes (Domain only!)
$manager->fetchRecord();
Fetch the DKIM DNS changes
$manager->fetchDkimRecords();
Request to verify the DKIM changes
$manager->verifyDkim();
Request to Enable DKIM
$manager->enableDkim();
Request to Disable DKIM
$manager->disableDkim();