federicozardi/eventing-laravel
最新稳定版本:v1.0.1
Composer 安装命令:
composer require federicozardi/eventing-laravel
包简介
Laravel integration for federicozardi/eventing: prebuilt EventBridge webhook with HMAC authentication and handler dispatch.
README 文档
README
Laravel integration for federicozardi/eventing.
Provides a prebuilt webhook endpoint for EventBridge HTTP targets:
- HMAC authentication (
X-Eventing-Timestamp,X-Eventing-Signature) - JSON envelope parsing + validation
- Idempotency via DynamoDB inbox (dedupe on
consumer + eventId) - Handler dispatch by
eventType
V1 processing is sync (as agreed). EventBridge retry policy handles transient failures.
Install
composer require federicozardi/eventing-laravel
php artisan vendor:publish --tag=config --provider="Amevista\\EventingLaravel\\Providers\\EventingServiceProvider"
Configuration
config/eventing.php:
webhook.path(default:/api/events/webhook)webhook.secret(EVENTING_WEBHOOK_SECRET)consumer_name(EVENTING_CONSUMER_NAME)inbox.table(EVENTING_INBOX_TABLE)event_store.disable_concurrency_check(EVENTING_DISABLE_CONCURRENCY_CHECK, default:true)handlers[eventType] => HandlerClass
Env vars (typical):
EVENTING_WEBHOOK_SECRET=supersecret
EVENTING_CONSUMER_NAME=payment-service
EVENTING_INBOX_TABLE=eventing_inbox
EVENTING_DISABLE_CONCURRENCY_CHECK=true
AWS_DEFAULT_REGION=eu-west-3
Handlers
Create a handler implementing Amevista\\Eventing\\Contracts\\EventHandlerInterface:
use Amevista\\Eventing\\Contracts\\EventHandlerInterface;
use Amevista\\Eventing\\Envelope\\EventEnvelope;
final class OrderCreatedHandler implements EventHandlerInterface
{
public function handle(EventEnvelope $event): void
{
// ...
}
}
Map it in config:
'handlers' => [
'order.created.v1' => \\App\\EventHandlers\\OrderCreatedHandler::class,
],
IaC notes (EventBridge → ALB Ingress)
This package assumes your IaC creates:
- EventBridge rule(s) matching
detail-type/source - HTTP target pointing to your ALB ingress URL + path
- Retry policy and (optionally) DLQ
- Secret management for
EVENTING_WEBHOOK_SECRET(Kubernetes Secret)
With ALB Ingress, do not rely on static IP allowlists as primary authentication; use HMAC.
IAM notes (consumer)
This package performs inbox dedupe (DynamoDB PutItem) before dispatching handlers.
If EVENTING_DISABLE_CONCURRENCY_CHECK=true (default), the event store may also read the event store HEAD
(dynamodb:GetItem) to append events best-effort.
Minimal DynamoDB permissions typically include:
- Inbox table:
dynamodb:PutItem - Event store table:
- transactional writes:
dynamodb:PutItem,dynamodb:UpdateItem,dynamodb:ConditionCheckItem - reads:
dynamodb:GetItem(forHEADwhen concurrency checks are disabled),dynamodb:Query(for loads)
- transactional writes:
Monorepo development note
In this monorepo the composer.json uses a path repository to resolve federicozardi/eventing locally. When you extract to separate repositories and tag releases, you should remove that block.
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-30