PHPackages                             softonic/laravel-protobuf-events - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. softonic/laravel-protobuf-events

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

softonic/laravel-protobuf-events
================================

Helper to allow nuwber/rabbitevents to work with protobuf

4.0.0(4mo ago)010.2k↓42.9%[1 issues](https://github.com/softonic/laravel-protobuf-events/issues)Apache-2.0PHPPHP &gt;=8.5CI passing

Since Dec 10Pushed 4mo ago5 watchersCompare

[ Source](https://github.com/softonic/laravel-protobuf-events)[ Packagist](https://packagist.org/packages/softonic/laravel-protobuf-events)[ Docs](https://github.com/softonic/laravel-protobuf-events)[ RSS](/packages/softonic-laravel-protobuf-events/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (19)Used By (0)

Laravel Protobuf Events
=======================

[](#laravel-protobuf-events)

[![Latest Version](https://camo.githubusercontent.com/3ee4ce8e28ad75e2229936edf663d9a7971032f779e828732e7699b2a6743370/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f736f66746f6e69632f6c61726176656c2d70726f746f6275662d6576656e74732e7376673f7374796c653d666c61742d737175617265)](https://github.com/softonic/laravel-protobuf-events/releases)[![Software License](https://camo.githubusercontent.com/36cfc741510e076bec951c1421a2b1c3a5553e953fcdb378339626a5f33c1e8d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865253230322e302d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/09177e0a2df2517bd775284fbbbe4e6aaa537858b4ee1cccfb32d38fdef6e15c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736f66746f6e69632f6c61726176656c2d70726f746f6275662d6576656e74732f74657374732e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/softonic/laravel-protobuf-events/actions/workflows/tests.yml)[![Total Downloads](https://camo.githubusercontent.com/664edb1dcf397b9e05b0ac27a59ea210bf81954de2a75fc5f0fb3a69ca5824cb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736f66746f6e69632f6c61726176656c2d70726f746f6275662d6576656e74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/softonic/laravel-protobuf-events)[![Average time to resolve an issue](https://camo.githubusercontent.com/623e5cfc474a33fae071a202cdacfc2a5a9632c2e7b4eccd9d3791a44d98f3ea/687474703a2f2f697369746d61696e7461696e65642e636f6d2f62616467652f7265736f6c7574696f6e2f736f66746f6e69632f6c61726176656c2d70726f746f6275662d6576656e74732e7376673f7374796c653d666c61742d737175617265)](http://isitmaintained.com/project/softonic/laravel-protobuf-events "Average time to resolve an issue")[![Percentage of issues still open](https://camo.githubusercontent.com/6fd4b7108973edccbf360430d0df3cd3c88ac1adf65491f637abc30d9e1a77ca/687474703a2f2f697369746d61696e7461696e65642e636f6d2f62616467652f6f70656e2f736f66746f6e69632f6c61726176656c2d70726f746f6275662d6576656e74732e7376673f7374796c653d666c61742d737175617265)](http://isitmaintained.com/project/softonic/laravel-protobuf-events "Percentage of issues still open")

Helper to allow nuwber/rabbitevents to work with protobuf

Requirements
------------

[](#requirements)

- PHP &gt;= 8.5
- Laravel 12.x

Main features
-------------

[](#main-features)

- Allow to publish/listen protobuf messages using nuwber/rabbit-events easily.

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

[](#installation)

You can require the last version of the package using composer

```
composer require softonic/laravel-protobuf-events
```

### Configuration

[](#configuration)

First you need to configure the [nuwber/rabbit-events package](https://github.com/nuwber/rabbitevents) to be able to use the package.

Then you must configure `config/protobuf-events.php` to set the client of the library. This client allows to isolate different services, identifying the origin of the message.

#### Configuring a listener

[](#configuring-a-listener)

In the `RabbitEventsServiceProvider::boot()` register the listeners that you want using the `ExternalEvents::decorateListener()` method.

```
    /**
     * Register any events for your application.
     */
    public function boot(): void
    {
        $this->listen = [
            'my.routing.key' => [
                ExternalEvents::decorateListener(MyListener::class),
            ],
        ];

        parent::boot();
    }
```

The listener needs a method called `handle()` that will receive the message and the routing key, and a method called `setClient()` to identify the origin of the message.

```
class MyListener
{
    public function setClient(string $client): void
    {
        // ...
    }
    public function handle(ProtobufExampleMessage $event): void
    {
        // ...
    }
}
```

#### Publishing messages

[](#publishing-messages)

To publish a message, you need to use the `ExternalEvents::publish()` method.

```
ExternalEvents::publish(
    ':service:',
    (new ProtobufExampleMessage)
        ->setName('My name')
        ->setAge(10)
);
```

#### Advanced usage

[](#advanced-usage)

Sometimes you need to use the package in a different way than the default. For example, you can use the package to decode a message from a string. In that case, you are able to decode the message using the `ExternalEvents::decode()` method.

```
$message = ExternalEvents::decode(
    ProtobufExampleMessage::class,
    '\n My name\n 10\n' // The message is a string with the protobuf message.
);
```

### Logging protobuf messages

[](#logging-protobuf-messages)

If you want to log the outgoing protobuf messages and the incoming ones, you can configure a logger and a formatter for the message to be logged. For that purpose you have the methods `ExternalEvents::setLogger()` and `ExternalEvents::setFormatter()`. The logger must implement the `Psr\Log\LoggerInterface` and the formatter, the `LogMessageFormatterInterface` interface.

```
ExternalEvents::setLogger(Log:getFacadeRoot());
ExternalEvents::setFormatter(new ProtobufLogMessageFormatter());
```

The formatter will have two methods, `formatOutgoingMessage()` and `formatIncomingMessage()`, that will be called when a message is sent or received, respectively. Both should return a `LogMessage` object, which contains the message to log and the context.

The log level can be changed by setting the `communications_log_level` key in `config/protobuf-events.php`.

Testing
-------

[](#testing)

`softonic/laravel-protobuf-events` has a [PHPUnit](https://phpunit.de) test suite, and a coding style compliance test suite using [PHP CS Fixer](http://cs.sensiolabs.org/).

To run the tests, run the following command from the project folder.

```
docker compose run --rm test
```

To run PHPUnit only:

```
docker compose run --rm phpunit
```

To check code style:

```
docker compose run --rm php composer run checkstyle
```

To fix code style issues:

```
docker compose run --rm fixcs
```

To run static analysis:

```
docker compose run --rm phpstan
```

To open a terminal in the dev environment:

```
docker compose run --rm php sh
```

License
-------

[](#license)

The Apache 2.0 license. Please see [LICENSE](LICENSE) for more information.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance77

Regular maintenance activity

Popularity22

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 65.7% 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 ~99 days

Recently: every ~170 days

Total

16

Last Release

125d ago

Major Versions

1.1.1 → 2.0.02023-03-22

2.1.5 → 3.0.02025-02-06

3.0.0 → 4.0.02026-01-13

PHP version history (4 changes)1.0.0PHP &gt;=8.0

2.1.0PHP &gt;=8.1

3.0.0PHP &gt;=8.3

4.0.0PHP &gt;=8.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/524887?v=4)[Joskfg](/maintainers/Joskfg)[@joskfg](https://github.com/joskfg)

---

Top Contributors

[![xaviapa](https://avatars.githubusercontent.com/u/8439057?v=4)](https://github.com/xaviapa "xaviapa (23 commits)")[![alexander-rubia](https://avatars.githubusercontent.com/u/105201206?v=4)](https://github.com/alexander-rubia "alexander-rubia (5 commits)")[![joskfg](https://avatars.githubusercontent.com/u/524887?v=4)](https://github.com/joskfg "joskfg (3 commits)")[![Lotykun](https://avatars.githubusercontent.com/u/9845202?v=4)](https://github.com/Lotykun "Lotykun (2 commits)")[![Lotykun-Softonic](https://avatars.githubusercontent.com/u/130476160?v=4)](https://github.com/Lotykun-Softonic "Lotykun-Softonic (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/softonic-laravel-protobuf-events/health.svg)

```
[![Health](https://phpackages.com/badges/softonic-laravel-protobuf-events/health.svg)](https://phpackages.com/packages/softonic-laravel-protobuf-events)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[illuminate/pipeline

The Illuminate Pipeline package.

9346.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)[illuminate/cookie

The Illuminate Cookie package.

224.3M122](/packages/illuminate-cookie)

PHPackages © 2026

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