Download the PHP package pralhadstha/php-mailer-gateways without Composer
On this page you can find all versions of the php package pralhadstha/php-mailer-gateways. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pralhadstha/php-mailer-gateways
More information about pralhadstha/php-mailer-gateways
Files in pralhadstha/php-mailer-gateways
Package php-mailer-gateways
Short Description Framework-agnostic PHP mailer with pluggable providers (SMTP, SparkPost, Amazon SES, Mailgun and more) on top of Symfony Mailer.
License MIT
Informations about the package php-mailer-gateways
php-mailer-gateways
Framework-agnostic PHP mailer with pluggable providers (SMTP, SparkPost, Amazon SES, Mailgun and more), built on top of Symfony Mailer. Works in any PHP frameworks or plain PHP.
Then send from anywhere in the app:
Messages are built with Symfony's own Symfony\Component\Mime\Email, so there's no
separate message DTO to learn.
If you'd rather build and hold onto a MailerInterface yourself instead of going
through the static Mail facade, use MailerFactory directly — see "Without the
Mail facade" below.
Requirements
- PHP >= 8.1
symfony/mailer— installed automatically, coverssmtp,null, andarray.- Each other provider needs its own bridge installed alongside this package — see the table below. Nothing is pulled in for a provider you don't use.
Installation
Then add the bridge for the provider(s) you actually use:
| Provider | Install command |
|---|---|
smtp |
(nothing extra needed) |
ses |
composer require symfony/amazon-mailer |
mailgun |
composer require symfony/mailgun-mailer |
sparkpost |
composer require gam6itko/sparkpost-mailer |
Per-provider config
Each entry under mailers in Mail::configure() is a provider key plus that
provider's config. The same array shape works with MailerFactory::create() directly
(see below).
region is optional for ses/mailgun/sparkpost. port is optional for smtp.
Testing your own code
Use the array provider to capture sent mail in memory instead of delivering it.
Mail::transport() returns the raw transport behind a configured mailer:
Without the Mail facade
For cases where you'd rather hold onto a MailerInterface yourself (e.g. injecting it
through your framework's container) instead of the static facade:
Adding a provider
Implement Pralhadstha\Mail\Provider\ProviderInterface::dsn(array $config): string
to build the Symfony Mailer DSN from your own config keys, then register it on the
factory used by Mail::configure() or built directly:
If the provider's transport factory isn't one of Symfony's own bridges, also register
it so Transport::fromString() can resolve the DSN:
Framework implementation
See examples/ directory for full runnable examples.
- Yii2 package:
package-of-yii/mailer-gateways - Laravel : Not published
- Symfony : Not published
- Vanilla PHP
Development
All versions of php-mailer-gateways with dependencies
symfony/mailer Version ^6.4 || ^7.0
symfony/http-client Version ^6.4 || ^7.0