hashemi/too-mailable
Composer 安装命令:
composer require hashemi/too-mailable
包简介
A Laravel based package for changing `Mail` transport and it's credentials from application layer in runtime. Simple and easy abstraction `Mailable` layer will be provided with this package. Currently this package support only SMTP
README 文档
README
A Laravel based package for changing Mail transport and it's credentials from application layer in runtime. Simple and easy abstraction Mailable layer will be provided with this package. Currently this package support only SMTP.
Installation
You can start it from composer. Go to your terminal and run this command from your project root directory.
composer require hashemi/laravel-too-mailable
- If you're using Laravel, then Laravel will automatically discover the package. In case it doesn't discover the package then add the following provider in your
config/app.php's providers array.
Hashemi\TooMailable\TooMailableServiceProvider::class
Usage
This package will be provide TooMailable abstract class and you need to use your mail class. This abstract class has two abstract method.
-
transport(): string|EsmtpTransportThis method will be return package supported transport by string or custom transport class which will beEsmtpTransportinherited. -
credentials(): arrayThis method will be return necessary credentials of current transport.
Example:
use Hashemi\TooMailable\TooMailable; class SendVerificatioMail extends TooMailable { //... public function transport() { return 'amazon'; } public function credentials() { return [ 'username' => 'my-user', 'password' => 'password-123', 'region' => 'us-east-2' ]; } }
This package is also contain a config where each built-in transport class is configured. If anyone needs to override that transport they can easily do it by publish config from vendor. Config file will be stored in config/too-mailable.php on your application.
Example:
use Hashemi\TooMailable\Transports\{ Amazon, Google, Mailchimp, Mailgun, Mailjet, OhMySmtp, Postmark, Sendgrid, SendInBlue }; return [ 'transports' => [ 'amazon' => Amazon::class, 'google' => Google::class, 'mailchimp' => Mailchimp::class, 'mailgun' => Mailgun::class, 'mailjet' => Mailjet::class, 'postmark' => Postmark::class, 'sendgrid' => Sendgrid::class, 'sendinblue' => SendInBlue::class, 'oh-my-smtp' => OhMySmtp::class, ], ];
So if you want to change exists transport then,
return [ 'transports' => [ //... 'amazon' => MyNewAmazonTransport::class, ], ];
Or, if you want to add new transport then,
return [ 'transports' => [ //... 'converkit' => MyNewConvertKit::class ], ];
But MyNewConvertKit class should be implements Hashemi\TooMailable\Interfaces\TransportInterface interface. Credentials will be passed through __construct function of MyNewConvertKit class.
Contributing
Pull requests are welcome. For any changes, please open an issue first to discuss what you would like to change.
hashemi/too-mailable 适用场景与选型建议
hashemi/too-mailable 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 2, 最近一次更新时间为 2022 年 11 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel-mail」 「laravel-package」 「mailable」 「laravel-mailable」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hashemi/too-mailable 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hashemi/too-mailable 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hashemi/too-mailable 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel package for converting English numbers into Bangla digits, Bangla words, Bangla month names, and Bangla money format with an easy-to-use API.
Send mails after DB transaction is committed
Laravel table comments loader (part of Diplodocker project)
jitone-ai is a powerful FilamentPHP plugin that integrates AI-powered features directly into your Filament forms.
Next generation emails for Laravel
Laravel JWT auth service package
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-02