PHPackages                             alazziaz/laravel-dapr-publisher - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. alazziaz/laravel-dapr-publisher

ActiveLibrary

alazziaz/laravel-dapr-publisher
===============================

Publisher helpers for sending Laravel events over Dapr Pub/Sub.

v2.1.1(4mo ago)10MITPHPPHP ^8.2

Since Oct 28Pushed 4mo agoCompare

[ Source](https://github.com/alazzi-az/laravel-dapr-publisher)[ Packagist](https://packagist.org/packages/alazziaz/laravel-dapr-publisher)[ RSS](/packages/alazziaz-laravel-dapr-publisher/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (9)Versions (35)Used By (0)

Dapr Events Publisher
=====================

[](#dapr-events-publisher)

[![Packagist Version](https://camo.githubusercontent.com/6eb431aca5476f0e27b5faef8130c1402af9d211d45c0bfa6f3275d69c6b21f3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c617a7a69617a2f6c61726176656c2d646170722d7075626c69736865722e7376673f636f6c6f723d306636616234)](https://packagist.org/packages/alazziaz/laravel-dapr-publisher)[![Total Downloads](https://camo.githubusercontent.com/586286166ea4205e1645953cb8a53fb2bcb9d4f134afbd85da0b4aa09f71fbc6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c617a7a69617a2f6c61726176656c2d646170722d7075626c69736865722e737667)](https://packagist.org/packages/alazziaz/laravel-dapr-publisher)

Helper classes and middleware pipeline for publishing Laravel events through the Dapr sidecar.

Installation
------------

[](#installation)

```
composer require alazziaz/laravel-dapr-publisher
```

> Requires `alazziaz/laravel-dapr-foundation` which provides shared config and topic resolution.

EventPublisher
--------------

[](#eventpublisher)

```
$publisher = app(\AlazziAz\LaravelDaprPublisher\EventPublisher::class);
$publisher->publish(new App\Events\OrderPlaced($id, $amount));
```

Publishing behaviour:

- Resolves the topic via `TopicResolver` (`App\Events\OrderPlaced` → `order.placed`).
- Serializes the event payload (array, JsonSerializable, `ProvidesPayload`, or property map).
- Wraps the payload in a CloudEvent envelope (`serialization.wrap_cloudevent`).
- Sends the result via `DaprClient::publishEvent`.

Middleware pipeline
-------------------

[](#middleware-pipeline)

Configure middleware in `config/dapr.php` under `publisher.middleware`:

- `AddCorrelationId` – propagates/creates a correlation ID and logs it.
- `AddTenantContext` – forwards `X-Tenant-ID` or the authenticated user's tenant identifier.
- `AddTimestamp` – stamps the publish time in RFC3339 format.

You can push additional middleware classes to mutate metadata or payloads before the publish call.

Testing
-------

[](#testing)

Use the fake to assert publishing:

```
$fake = \AlazziAz\LaravelDaprPublisher\Testing\DaprEventFake::register(app());

event(new App\Events\OrderPlaced('123', 9900));

$fake->assertPublished(App\Events\OrderPlaced::class);
```

See `tests/EventPublisherTest.php` for more examples.

PHP compatibility note
----------------------

[](#php-compatibility-note)

Because the official `dapr/php-sdk` only publishes `dev-main` builds and targets PHP 8.4, consuming apps on PHP 8.2/8.3 must either allow dev stability (with `prefer-stable` still true) or lock to an SDK tag that supports their PHP version until upstream ships a stable release.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance77

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Recently: every ~10 days

Total

34

Last Release

125d ago

Major Versions

v1.0.1 → v2.0.02025-10-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/750a1566a9f2ed8de9e8da9fee372b4426d7585bfdabdb65a1932a40e409a3e3?d=identicon)[alazzi](/maintainers/alazzi)

---

Top Contributors

[![mohammedazman](https://avatars.githubusercontent.com/u/56982649?v=4)](https://github.com/mohammedazman "mohammedazman (10 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/alazziaz-laravel-dapr-publisher/health.svg)

```
[![Health](https://phpackages.com/badges/alazziaz-laravel-dapr-publisher/health.svg)](https://phpackages.com/packages/alazziaz-laravel-dapr-publisher)
```

###  Alternatives

[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M191](/packages/spatie-laravel-backup)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[illuminate/view

The Illuminate View package.

13144.9M1.7k](/packages/illuminate-view)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
