esign/laravel-unleash-webhook-client
Composer 安装命令:
composer require esign/laravel-unleash-webhook-client
包简介
Receive Unleash webhooks within a Laravel application
README 文档
README
This package builds on top of Spatie's Laravel Webhook Client package to provide handling of Unleash webhooks in Laravel applications.
Installation
You can install the package via composer:
composer require esign/laravel-unleash-webhook-client
Configuration
You may follow the steps under the configuration section of Spatie's Laravel Webhook Client package.
You can find the WEBHOOK_CLIENT_SECRET in the website's configuration section of Unleash.
To set up a webhook, register a new webhook under the Webhooks section for the desired module.
Set the webhook URL to the route you have configured in your Laravel application, for example: Route::webhooks('unleash-webhook');
Processing webhooks
To process the webhook, extend the Esign\UnleashWebhookClient\Jobs\ProcessUnleashWebhookJob job in your application.
You can use its getWebhookEntries method to extract the relevant data from the webhook payload and process it as needed.
namespace App\Jobs; use App\Models\Redirect; use App\Models\Translation; use Esign\UnleashWebhookClient\Jobs\ProcessUnleashWebhookJob as BaseProcessUnleashWebhookJob; class ProcessUnleashWebhookJob extends BaseProcessUnleashWebhookJob { public function handle(): void { foreach ($this->getWebhookEntries() as $webhookEntry) { match ($webhookEntry->table) { (new Translation)->getTable() => $this->handleTranslationsWebhook($webhookEntry), (new Redirect)->getTable() => $this->handleRedirectsWebhook($webhookEntry), default => null, }; } } protected function handleTranslationsWebhook(WebhookEntry $webhookEntry): void { // Handle the translation webhook entry } protected function handleRedirectsWebhook(WebhookEntry $webhookEntry): void { // Handle the redirects webhook entry } }
Mocking Unleash Webhooks in Tests
This package provides a MocksUnleashWebhooks trait to simplify testing Unleash webhook integrations in your Laravel application.
The trait allows you to easily send signed webhook requests using fixture files or custom payloads.
use Esign\UnleashWebhookClient\Testing\MocksUnleashWebhooks; class ExampleTest extends TestCase { use MocksUnleashWebhooks; #[Test] public function it_can_process_unleash_webhooks(): void { $responseA = $this->makeUnleashWebhookRequest(['example' => 'data']); $responseB = $this->makeUnleashWebhookRequestFromFixture('example-webhook.json'); $responseA->assertOk(); $responseB->assertOk(); } }
By default, fixture files are expected to be located in the tests/Fixtures/UnleashWebhooks/ directory.
You may provide a custom path for the fixture files using the usingUnleashWebhookFixturePath(?string $path) method.
Running Tests
composer test
License
The MIT License (MIT). Please see License File for more information.
esign/laravel-unleash-webhook-client 适用场景与选型建议
esign/laravel-unleash-webhook-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 545 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 09 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「esign」 「unleash-webhook-client」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 esign/laravel-unleash-webhook-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 esign/laravel-unleash-webhook-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 esign/laravel-unleash-webhook-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A laravel package to make your eloquent models translatable.
Manage SEO tags within your Laravel application
Load translations from the database or other sources.
Associate files with your Laravel Models
Generate slugs when saving UnderscoreTranslatable models
Throttle exceptions being sent to Sentry
统计信息
- 总下载量: 545
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-01