webup/laravel-sendinblue
最新稳定版本:v3.5.0
Composer 安装命令:
composer require webup/laravel-sendinblue
包简介
Laravel's mail transport for SendinBlue
README 文档
README
As of April 2023 this repo is deprecated and unmaintained.
Since Laravel 9, there is official support for Sendinblue as a regular mail transport thanks to symfony/sendinblue-mailer. It supports SiB through API and SMTP, with templates, tags, and custom headers. Because Laravel 8 has reached its end of life, the official support has now become the new default.
You can find more about how to use it inside your Laravel project in the Laravel documentation.
For any need beyond beyond that, use Sendinblue's official PHP SDK.
Feel free to fork this repository if you need to modify it for legacy reasons.
Special thanks to the wonderful contributors that kept this project standing over the years ????. You rock ????
Summary
Installation
composer require webup/laravel-sendinblue
Compatibility
| Version | Laravel | Sendinblue Api |
|---|---|---|
| 3.* | 7.0 and above | v3 |
| 2.* | 5.5 - 6.* | v3 |
| 1.1.* | 5.5 - 6.* | v2 |
| 1.0.* | 5.0 - 5.4 | v2 |
Configuration
config/mail.php
'mailers' => [ // ... 'sendinblue' => [ 'transport' => 'sendinblue', ], ]
config/services.php
'sendinblue' => [ // api-key or partner-key 'key_identifier' => env('SENDINBLUE_KEY_IDENTIFIER', 'api-key'), 'key' => env('SENDINBLUE_KEY'), ],
.env
MAIL_MAILER=sendinblue
SENDINBLUE_KEY=your-access-key
# if you need to set the guzzle proxy config
# those are example values
HTTP_PROXY="tcp://localhost:8125"
HTTPS_PROXY="tcp://localhost:9124"
NO_PROXY=.mit.edu,foo.com
Usage in Mailable with Template Id
Using the sendinblue() method you may pass extra fields listed below. All fields are optional:
template_id(integer)tags(array)params(array)
If you want to use the subject defined in the template, it's necessary to pass
the SendinBlueTransport::USE_TEMPLATE_SUBJECT placeholder in the subject(). You may as well override the subject
text here. Otherwise, without the subject() method, the subject will be derived from the class name.
Mailable requires a view - pass an empty array in the view() method.
<?php declare(strict_types=1); namespace App\Mail; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Webup\LaravelSendinBlue\SendinBlue; // <- you need this use Webup\LaravelSendinBlue\SendinBlueTransport; // <- you need this class MyMailable extends Mailable { use Queueable; use SerializesModels; use SendinBlue; // <- you need this // ... public function build() { return $this ->view([]) ->subject(SendinBlueTransport::USE_TEMPLATE_SUBJECT) // use template subject // ->subject('My own subject') // subject overridden ->sendinblue( [ 'template_id' => 84, 'tags' => ['offer'], 'params' => [ 'FIRSTNAME' => 'John', 'LINK' => 'https://www.example.com', 'AMOUNT' => '29', ], ] ); } }
Params are accessbile in the SendinBlue template as:
{{ params.FIRSTNAME }}{{ params.LINK }}{{ params.AMOUNT }}
You may as well use param substitution in the subject field, eg.:
{{ params.FIRSTNAME }}, forgot your password?!
Note: Do not use hyphens '-' in the variable names. {{ params.FIRST_NAME }} will work properly, but {{ params.FIRST-NAME }} will fail. Source: sendinblue/APIv3-php-library#151
Regarding additional features
This library aims to provide a Laravel-compatible interface for SendInBlue along with support for template ids, tags and params.
If you need features like specific SendInBlue beta SMTP Template batching, you should directly use the official SendInBlue PHP library.
webup/laravel-sendinblue 适用场景与选型建议
webup/laravel-sendinblue 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 524.56k 次下载、GitHub Stars 达 120, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「mailing」 「laravel」 「laravel5」 「sendinblue」 「lumen」 「stmp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 webup/laravel-sendinblue 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 webup/laravel-sendinblue 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 webup/laravel-sendinblue 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Mailing module for HiPanel
Powerful newsletter system for TYPO3
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Laravel helpers for dev
Send SMS and SMS Notification via Mailjet for Laravel
The ultimate Craft CMS mailing list builder. Collect emails easily and sync with popular mailing list services.
统计信息
- 总下载量: 524.56k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 121
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 未知