bhekor/laravel-brevo
Composer 安装命令:
composer require bhekor/laravel-brevo
包简介
Laravel package for Brevo (ex-Sendinblue) API integration
README 文档
README
Complete Brevo (formerly Sendinblue) integration for Laravel, including email support, webhook handling, and optional Vue components.
Features
- Seamless integration with Laravel's Mail facade
- Full support for Markdown Mailables
- Multiple usage options (default mailer, explicit mailer, facade)
- Webhook handling
- Optional Vue components for analytics
- Comprehensive error handling
- Modern PHP & Laravel practices (strict typing, PSR-12, PHPDoc)
Installation
composer require bhekor/laravel-brevo
Configuration
Publish the config file:
php artisan vendor:publish --tag=brevo-config
Set your API key and sender details in your .env:
MAIL_MAILER=brevo BREVO_API_KEY=your_api_key BREVO_FROM_EMAIL=noreply@example.com BREVO_FROM_NAME="Your App"
Frontend Integration (Optional)
Install frontend dependencies:
npm install --save-dev @vueuse/core chart.js php artisan vendor:publish --tag=brevo-assets
In your resources/js/app.js:
import Brevo from '../../public/vendor/laravel-brevo/brevo'; import { createApp } from 'vue'; const app = createApp({}); app.use(Brevo, { apiBaseUrl: '/brevo-api' });
Use components in your Vue template:
<template> <BrevoStats /> <BrevoWebhookLogs /> </template>
Usage
Regular Mailable
Mail::to('user@example.com')->send(new OrderShipped());
Markdown Mailable
namespace App\Mail; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; class OrderShipped extends Mailable { use Queueable, SerializesModels; public function build() { return $this->markdown('emails.orders.shipped') ->with([ 'order' => $this->order, ]); } }
Using the Facade
Brevo::email()->send(new OrderShipped());
Webhooks
- Register your webhook endpoint in the Brevo dashboard.
- Add the following to your
routes/api.php:
Route::brevoWebhooks('/brevo/webhook');
Testing
composer test
Security Vulnerabilities
Please report any security vulnerabilities to security@bhekor.com.
Test Suite
The package includes a robust set of unit and feature tests to ensure reliability.
Directory Structure
tests/
├── Feature/
│ ├── MailTransportTest.php
│ └── WebhookTest.php
└── Unit/
├── BrevoClientTest.php
├── EventMapperTest.php
├── MailTransportTest.php
├── TransactionalEmailTest.php
└── WebhookControllerTest.php
Run all tests with:
composer test
Or use PHPUnit directly:
./vendor/bin/phpunit
Package Structure
bhekor/
└── laravel-brevo/
├── config/
│ └── brevo.php
├── resources/
│ └── js/
│ ├── components/
│ │ ├── BrevoStats.vue
│ │ └── BrevoWebhookLogs.vue
│ └── brevo.js
├── src/
│ ├── BrevoServiceProvider.php
│ ├── Contracts/
│ │ ├── BrevoClientInterface.php
│ │ └── MailTransportInterface.php
│ ├── Exceptions/
│ │ ├── BrevoApiException.php
│ │ ├── BrevoConfigurationException.php
│ │ └── BrevoValidationException.php
│ ├── Facades/
│ │ └── Brevo.php
│ ├── Mail/
│ │ └── BrevoTransport.php
│ ├── Services/
│ │ ├── BrevoClient.php
│ │ └── TransactionalEmail.php
│ └── Webhooks/
│ ├── EventMapper.php
│ ├── WebhookController.php
│ └── routes.php
├── tests/
│ ├── Feature/
│ │ ├── MailTransportTest.php
│ │ └── WebhookTest.php
│ └── Unit/
│ ├── BrevoClientTest.php
│ ├── EventMapperTest.php
│ ├── MailTransportTest.php
│ ├── TransactionalEmailTest.php
│ └── WebhookControllerTest.php
├── composer.json
├── package.json
└── README.md
bhekor/laravel-brevo 适用场景与选型建议
bhekor/laravel-brevo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.49k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 05 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「email」 「sms」 「laravel」 「marketing」 「sendinblue」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 bhekor/laravel-brevo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bhekor/laravel-brevo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 bhekor/laravel-brevo 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
SDK for payment gateway PlatbaMobilom.sk for PHP7.0
Extensible library for building notifications and sending them via different delivery channels.
Email+ extends Kirby's email capabilities by adding support for multiple email services using the same Kirby email API.
yii2-sms expand
Laravel contact us form package to send email and save to database
统计信息
- 总下载量: 1.49k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-31