korridor/symfony-scaleway-tem-mailer
最新稳定版本:0.0.3
Composer 安装命令:
composer require korridor/symfony-scaleway-tem-mailer
包简介
Symfony Scaleway transaction email (TEM) Mailer Bridge
README 文档
README
Warning
This package is no longer necessary since Symfony created their own mailer for Scaleway TEM.
Please use this instead: Symfony Mailer - Scaleway
Installation
You can install the package via composer with following command:
composer require korridor/symfony-scaleway-tem-mailer
Requirements
This package is tested for the following Laravel and PHP versions:
- 9.* (PHP 8.1)
Usage examples
Laravel
Add the following code to the AppServiceProvider:
use Korridor\SymfonyScalewayTemMailer\Transport\ScalewayApiTransport; use Korridor\SymfonyScalewayTemMailer\Transport\ScalewaySmtpTransport; // .. /** * Bootstrap any application services. * * @return void */ public function boot(): void { // ... Mail::extend('scaleway-api', function (array $config = []) { return new ScalewayApiTransport($config['token'], $config['region'], $config['project_id']); }); Mail::extend('scaleway-smtp', function (array $config = []) { return new ScalewaySmtpTransport($config['token'], $config['region'], $config['project_id']); }); }
Now add the following lines to the config/mail.php file in the mailers array:
'scaleway' => [ 'transport' => 'scaleway-api', 'region' => env('MAIL_SCALEWAY_REGION', 'fr-par'), 'token' => env('MAIL_SCALEWAY_TOKEN'), 'project_id' => env('MAIL_SCALEWAY_PROJECT_ID'), ],
If you want to use the SMTP integration instead use following lines:
'scaleway' => [ 'transport' => 'scaleway-smtp', 'region' => env('MAIL_SCALEWAY_REGION', 'fr-par'), 'token' => env('MAIL_SCALEWAY_TOKEN'), 'project_id' => env('MAIL_SCALEWAY_PROJECT_ID'), ],
Symfony
Add the following lines to the config/services.yaml file:
mailer.transport_factory.scaleway: class: Korridor\SymfonyScalewayTemMailer\Transport\ScalewayTransportFactory parent: mailer.transport_factory.abstract tags: - {name: mailer.transport_factory}
Then MAILER_DSN environment variable for example like this:
MAILER_DSN=scaleway+api://SCW_PROJECT_ID:SCW_SECRET_KEY@api.scaleway.com
Contributing
I am open for suggestions and contributions. Just create an issue or a pull request.
Local docker environment
The docker folder contains a local docker environment for development.
The docker workspace has composer and xdebug installed.
docker-compose run workspace bash
Testing
The composer test command runs all tests with phpunit.
The composer test-coverage command runs all tests with phpunit and creates a coverage report into the coverage
folder.
Codeformatting/Linting
The composer fix command formats the code with php-cs-fixer.
The composer lint command checks the code with phpcs.
Credits
The structure of the repository is inspired by the project symfony/postmark-mailer.
License
This package is licensed under the MIT License (MIT). Please see license file for more information.
统计信息
- 总下载量: 660
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-05