Download the PHP package juhasev/laravel-ses without Composer
On this page you can find all versions of the php package juhasev/laravel-ses. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download juhasev/laravel-ses
More information about juhasev/laravel-ses
Files in juhasev/laravel-ses
Package laravel-ses
Short Description Allows you to track opens, deliveries, bounces, complaints and clicked links when sending emails through Laravel and Amazon SES
License MIT
Informations about the package laravel-ses
Laravel SES (Simple Email Service AWS)
Laravel SES is package that allows you to get sending statistics for emails you send through AWS SES (Simple Email Service), including deliveries, opens, bounces, complaints and link tracking. This package was originally written by Oliveready7. Unfortunately the original author had stopped maintaining this package so I decided to create this fork so that this package can be used with current versions of Laravel. The minimum requirement is PHP 7.3, Laravel 9 requires PHP 8.x.
All packages have been updated to modern versions. I have optimized the original database storage for space and proper indexing. This package is compatible with Laravel 9.x.
Laravel SES also supports SMTP errors codes will throw meaning exceptions like when you exceed your rate limits so you can handle proper back off.
Laravel version support:
- If you are using Laravel 11 use
v5.*
- If you are using Laravel 10 use
v4.*
- If you are using Laravel 9 use
v3.*
- If you are using Laravel 7 or 8 use
v1.1.5
- If you are using Laravel 6 use
v0.8.4
Installation
Install via composer
In config/app.php make sure you load up the service provider. This should happen automatically.
Laravel configuration
Make sure your app/config/services.php has SES values set
Make sure your mail driver located in app/config/mail.php is set to 'ses'
Publish public assets
Publish migrations
Publish the package's config (laravelses.php)
Routes
This package add 3 public routes to your application that AWS SNS callbacks target
We also add two more public routes for tracking opens and link clicks
Config Options
- aws_sns_validator - whether the package uses AWS's SNS validator for inbound SNS requests. Default = false
- debug - Debug mode that logs all SNS call back requests
https://github.com/aws/aws-php-sns-message-validator
AWS Configuration
Pre-reading
If you are new to using SES Notification this article is a good starting point
https://docs.aws.amazon.com/sns/latest/dg/sns-http-https-endpoint-as-subscriber.html
IAM User and policies
Your application IAM user needs to be send email via SES and subscribe to SNS notifications. This can be done in the AWS Control Panel as the article above suggests or AWS CloudFormation template like one below:
AWS CloudFormation policy example:
Once policies are defined they need to added to the configured IAM user.
Running setup
Make sure in your APP_URL (in .env) is set correctly, matching your sending domain. If you do send email for multiple domains (i.e. multi tenant application) you can set multiple domains using this command.
You need to have SES domain ready before continuing
The setup command automatically configures your SES domain to send SNS notifications that trigger call backs to your Laravel application.
NOTE: You should not attempt to use sub domains client.mydomain.com, this is not currently supported by AWS.
Usage
To send an email with all tracking enabled
Calling enableAllTracking() enables open, reject, bounce, delivery, complaint and link tracking.
Please note that an LaravelSesTooManyRecipients Exception is thrown if you attempt send a Mailable that contains multiple recipients when Open -tracking is enabled.
Other exception thrown are:
You can catch them all using the base class:
php SesMail::disableAllTracking(); SesMail::disableOpenTracking(); SesMail::disableLinkTracking(); SesMail::disableBounceTracking(); SesMail::disableComplaintTracking(); SesMail::disableDeliveryTracking();
SesMail::enableAllTracking(); SesMail::enableOpenTracking(); SesMail::enableLinkTracking(); SesMail::enableBounceTracking(); SesMail::enableComplaintTracking(); SesMail::enableDeliveryTracking();
[ "sent" => 8, "deliveries" => 7, "opens" => 4, "bounces" => 1, "complaints" => 2, "clicks" => 3, "link_popularity" => [ "https://welcome.page" => [ "clicks" => 3 ], "https://facebook.com/brand" => [ "clicks" => 1 ] ] ]
( [id] => 22 [sent_email_id] => 49 [type] => Permanent [bounced_at] => 2020-04-03 19:42:31 [sent_email] => Array ( [id] => 49 [message_id] => 31b530dce8e2a282d12e5627e7109580@localhost [email] => [email protected] [batch_id] => 7 [sent_at] => 2020-04-03 19:42:31 [delivered_at] => [batch] => Array ( [id] => 7 [name] => fa04cbf2c2:Project:268 [created_at] => 2020-04-03 17:03:23 [updated_at] => 2020-04-03 17:03:23 )
)
)
)
git clone https://github.com/juhasev/laravel-ses.git json "autoload": { "psr-4": { "App\": "app/", "Juhasev\LaravelSes\": "packages/juhasev/laravel-ses/src" } }, json require: { "juhasev/laravel-ses": "dev-master" } bash composer require juhasev/laravel-ses:dev-master bash phpunit
All versions of laravel-ses with dependencies
illuminate/contracts Version ^11.0
aws/aws-sdk-php Version ^3.288.0
ramsey/uuid Version ^4.3
guzzlehttp/guzzle Version ^7.8.1
aws/aws-php-sns-message-validator Version ^1.7
symfony/psr-http-message-bridge Version ^7.0
nyholm/psr7 Version ^1.0
voku/simple_html_dom Version ^4.8