baywa-re-lusy/email
最新稳定版本:2.2.2
Composer 安装命令:
composer require baywa-re-lusy/email
包简介
BayWa r.e. LUSY Email Tools
README 文档
README
Installation
To install the Email tools, you will need Composer in your project:
composer require baywa-re-lusy/email
Usage
Currently, this library supports MailGun and SendGrid.
MailGun
use BayWaReLusy\Email\Adapter\MailgunAdapter; use BayWaReLusy\Email\EmailService; $adapter = new MailgunAdapter('mailgun-api-key', 'mailgun-domain', 'https://api.eu.mailgun.net/'); $emailService = new EmailService($adapter);
AWS SES
use BayWaReLusy\Email\Adapter\AwsAdapter; use BayWaReLusy\Email\EmailService; $adapter = new AwsAdapter('aws-key', 'aws-secret', 'aws-region', 'domain'); $emailService = new EmailService($adapter);
Tests
The avoid sending emails during acceptance tests, but to still test that emails are sent, there is a mock EmailService (which inherits from the real EmailService) and an Email context.
To use the mock EmailService, you can replace the original EmailService in testing mode (e.g. in Module.php) :
if (getenv('ENV') === 'testing') { $config->merge(new Config(include __DIR__ . '/../../../tests/mocks.config.php')); }
And in mocks.config.php :
<?php return [ 'service_manager' => [ 'invokables' => [ \BayWaReLusy\Email\EmailService::class => \BayWaReLusy\Email\Test\EmailService::class, ], ... ], ];
统计信息
- 总下载量: 606
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2021-10-13