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

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

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

rkingbishnoi/brevo-laravel-sdk

Composer 安装命令:

composer require rkingbishnoi/brevo-laravel-sdk

包简介

A Laravel package that provides an easy-to-use interface for interacting with Brevo's email, SMS, and marketing automation services, enabling seamless API integration for messaging and campaign management.

README 文档

README

Packagist License Laravel PHP

A Laravel package providing an easy-to-use interface for interacting with Brevo's email, SMS, and marketing automation services. This SDK enables seamless API integration for messaging and campaign management.

📌 Features

Built on the Official Brevo PHP SDK

Easy Brevo API Integration

Support for Email, SMS, WhatsApp, and Campaign APIs

Simple Laravel Facade for Quick Usage

Built-in Exception Handling & API Validation

Secure API Key Configuration

📦 Installation

Step 1: Install via Composer

You can install the package via Composer:

composer require rkingbishnoi/brevo-laravel-sdk

Step 2: Publish the Configuration

Publish the package configuration file to your application: bash Copy Edit

php artisan vendor:publish --tag=config

This will create a config/brevo.php file where you can set your Brevo API key.

Step 3: Set the API Key

Add your Brevo API key in your .env file:

BREVO_API_KEY=your-brevo-api-key

🚀 Usage Guide

Once you have installed and configured the package, you can start using it in your Laravel application.

This package provides a facade (Brevo) for interacting with various Brevo API services such as Transactional Emails, SMS, Contacts, and Campaigns.

📝 Quick Cheat Sheet

ActionAPI MethodExample Usage 📌
Send Transactional EmailBrevo::transactionalEmailsApi()->sendTransacEmail()📌 View Code
Send Transactional SMSBrevo::transactionalSmsApi()->sendTransacSms()📌 View Code
Fetch Account DetailsBrevo::accountApi()->getAccount()📌 View Code
Fetch Contact ListsBrevo::listsApi()->getLists()📌 View Code
Send WhatsApp MessageBrevo::transactionalWhatsAppApi()->sendWhatsAppTemplateMessage()📌 View Code

📧 Sending an Email via Brevo

use Rkingbishnoi\BrevoLaravelSdk\Facades\Brevo;

try {
    $emailApi = Brevo::transactionalEmailsApi();
    $response = $emailApi->sendTransacEmail([
        'sender' => ['name' => 'Your Company', 'email' => 'your-email@yourdomain.com'],
        'to' => [['email' => 'recipient@example.com', 'name' => 'Recipient Name']],
        'subject' => 'Welcome to our platform!',
        'htmlContent' => '<p>Hello, thank you for signing up!</p>',
    ]);

    return response()->json(['success' => true, 'response' => $response]);
} catch (Exception $e) {
    return response()->json(['error' => $e->getMessage()], 500);
}

🔥 Error Handling

This package comes with built-in exception handling for API-related issues.

Handling Missing API Key If the API key is missing, the package will throw:

throw new MissingApiKeyException('The Brevo API key is missing. Please set the [BREVO_API_KEY] in your .env file or config/brevo.php.');```

How to Handle?

use Rkingbishnoi\BrevoLaravelSdk\Facades\Brevo;
use Rkingbishnoi\BrevoLaravelSdk\Exceptions\MissingApiKeyException;

try {
    $account = Brevo::accountApi()->getAccount();
} catch (MissingApiKeyException $e) {
    return response()->json(['error' => $e->getMessage()], 400);
} catch (Exception $e) {
    return response()->json(['error' => 'Something went wrong.'], 500);
}

Testing To run tests, use:

vendor/bin/phpunit

If you haven't installed Orchestra Testbench, install it with:

composer require --dev orchestra/testbench

Then run :

vendor/bin/phpunit

📄 License

This package is open-source software licensed under the MIT License.

📢 Contributing

We encourage and appreciate contributions! If you have any suggestions, improvements, or bug fixes, feel free to submit a pull request or start a discussion via issues.

📌 How to Contribute

  1. Fork the repository
  2. Create a new branch (git checkout -b feature-branch)
  3. Make your changes and ensure they follow best practices
  4. Commit your changes (git commit -m "Describe your changes")
  5. Push to your branch (git push origin feature-branch)
  6. Submit a pull request for review

🚀 Let's build something great together!

rkingbishnoi/brevo-laravel-sdk 适用场景与选型建议

rkingbishnoi/brevo-laravel-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「email marketing」 「laravel sms」 「laravel email」 「sms marketing」 「brevo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 rkingbishnoi/brevo-laravel-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 rkingbishnoi/brevo-laravel-sdk 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-19