bhekor/laravel-brevo 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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.

Latest Version on Packagist Total Downloads GitHub Tests Action Status PHPStan License PHP Version Support Laravel Version Support

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

  1. Register your webhook endpoint in the Brevo dashboard.
  2. 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 我们能提供哪些服务?
定制开发 / 二次开发

基于 bhekor/laravel-brevo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.49k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 26
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-31