jcergolj/brevo-webhook-manager-for-laravel
Composer 安装命令:
composer require jcergolj/brevo-webhook-manager-for-laravel
包简介
Brevo webhook manager for Laravel
README 文档
README
This CLI tool provides a convenient way to manage Brevo webhooks from the command line. It provides a number of commands for fetching, creating, updating, and deleting webhooks.
Features:
- Fetch webhooks from the Brevo API
- Create new webhooks
- Update existing webhooks
- Delete webhooks
Installation
Requirements
Required PHP >=8.2
Installing package
composer require jcergolj/brevo-webhook-manager-for-laravel
Publishing config file
php artisan vendor:publish --provider="Jcergolj\BrevoWebhookManager\BrevoWebhookMangerServiceProvider"
.env file
BREVO_API_KEY= USER_AGENT="" BREVO_BASE_URL=https://api.brevo.com/v3/ # Optional — override the default Brevo IP ranges (comma-separated CIDRs) BREVO_VALID_CIDRS=1.179.112.0/20,172.246.240.0/20 # Optional — allow requests coming through Cloudflare edge IPs BREVO_ALLOW_CLOUDFLARE=false # Required when using VerifyBrevoWebhookBasicAuthMiddleware BREVO_WEBHOOK_USERNAME= BREVO_WEBHOOK_PASSWORD= # Required when using VerifyBrevoWebhookTokenMiddleware BREVO_WEBHOOK_TOKEN= # Optional — header name carrying the token (default: Authorization) BREVO_WEBHOOK_TOKEN_HEADER=Authorization
Securing incoming webhooks
Two middlewares are shipped. Register them on your webhook route.
1. IP allow-list — VerifyBrevoWebhookMiddleware
Rejects any request whose source IP is outside the configured CIDRs. Defaults to Brevo's published ranges. Set BREVO_ALLOW_CLOUDFLARE=true if your webhook route sits behind Cloudflare so edge IPs are accepted too. Override the base list via BREVO_VALID_CIDRS.
2. Basic auth — VerifyBrevoWebhookBasicAuthMiddleware
Implements Brevo username/password authentication. When creating the webhook on Brevo, embed credentials in the URL:
https://USERNAME:PASSWORD@your-app.test/brevo/webhook
Set the same values in .env as BREVO_WEBHOOK_USERNAME and BREVO_WEBHOOK_PASSWORD. The middleware compares with hash_equals and aborts 401 on mismatch. If either env var is missing, the middleware aborts 500 (fail-closed).
3. Token auth — VerifyBrevoWebhookTokenMiddleware
Verifies a shared secret token sent in a request header. Defaults to reading Authorization: Bearer <token>. Configure a different header via BREVO_WEBHOOK_TOKEN_HEADER (e.g. X-Brevo-Token). When using a custom header, the raw header value is compared directly (no Bearer prefix). Set BREVO_WEBHOOK_TOKEN to the shared secret. Aborts 401 on mismatch, 500 if unconfigured.
4. See the Brevo docs
https://developers.brevo.com/docs/username-and-password-authentication
Route example
use Jcergolj\BrevoWebhookManager\Http\Middleware\VerifyBrevoWebhookBasicAuthMiddleware; use Jcergolj\BrevoWebhookManager\Http\Middleware\VerifyBrevoWebhookMiddleware; use Jcergolj\BrevoWebhookManager\Http\Middleware\VerifyBrevoWebhookTokenMiddleware; Route::post('/brevo/webhook', BrevoWebhookController::class) ->middleware([ VerifyBrevoWebhookMiddleware::class, VerifyBrevoWebhookBasicAuthMiddleware::class, // or VerifyBrevoWebhookTokenMiddleware::class ]);
Avaliable commands
php artisan brevo-webhooks:create-inbound
php artisan brevo-webhooks:create-marketing
php artisan brevo-webhooks:create-transactional
php artisan brevo-webhooks:update
php artisan brevo-webhooks:delete
php artisan brevo-webhooks:fetch
php artisan brevo-webhooks:fetch-all
jcergolj/brevo-webhook-manager-for-laravel 适用场景与选型建议
jcergolj/brevo-webhook-manager-for-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.72k 次下载、GitHub Stars 达 20, 最近一次更新时间为 2023 年 11 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jcergolj/brevo-webhook-manager-for-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jcergolj/brevo-webhook-manager-for-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 7.72k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 20
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-11-07
