承接 alazziaz/laravel-dapr-listener 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

alazziaz/laravel-dapr-listener

最新稳定版本:v2.1.1

Composer 安装命令:

composer require alazziaz/laravel-dapr-listener

包简介

Listener utilities for consuming Dapr Pub/Sub messages as Laravel events.

README 文档

README

Packagist Version Total Downloads

Discover Dapr topics, expose /dapr/subscribe, and handle ingress HTTP calls by re-dispatching Laravel events.

Installation

composer require alazziaz/laravel-dapr-listener

Depends on alazziaz/laravel-dapr-foundation for shared infrastructure.

Subscription discovery

The service provider scans app/Events and app/Listeners for the #[Topic] attribute and registers derived topics with the shared SubscriptionRegistry. Configured overrides in config/dapr.php are merged automatically.

Run php artisan dapr:list to inspect the discovered routes.

HTTP ingress

Routes are registered under the configurable prefix (default dapr):

  • GET /dapr/subscribe – list of {pubsubname, topic, route} subscriptions.
  • POST /dapr/ingress/{topic?} – wildcard handler invoked by the Dapr sidecar.

Requests may be wrapped in CloudEvents; the listener extracts the payload, hydrates the Laravel event class, and dispatches it through the application event dispatcher. Inbound events are marked so they are not re-published.

Listener middleware

Configured through listener.middleware:

  • RetryOnceMiddleware – retries the pipeline a single time before surfacing the exception (causing Dapr to retry based on component settings).
  • CorrelatedMessageMiddleware – restores correlation IDs from metadata for logging and downstream services.
  • TenantHydratorMiddleware – exposes tenant context via the Laravel context facade.

Artisan tooling

php artisan dapr:listener App\\Events\\OrderPlaced scaffolds a listener class in app/Listeners, defaulting to OrderPlacedListener.

The stub integrates cleanly with Laravel's native event system—no special base classes required.

PHP compatibility note

The listener depends on dapr/php-sdk, which currently only offers a dev-main branch targeting PHP 8.4. Projects running on PHP 8.2/8.3 should either loosen Composer’s minimum stability (while keeping prefer-stable: true) or pin the SDK to an earlier tag that supports their PHP version until a stable release is available.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-28