PHPackages                             nuwber/rabbitevents - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. nuwber/rabbitevents

ActiveLibrary[Queues &amp; Workers](/categories/queues)

nuwber/rabbitevents
===================

The Nuwber RabbitEvents package

v9.0.0(3mo ago)120515.8k↓17.7%35[1 issues](https://github.com/nuwber/rabbitevents/issues)[2 PRs](https://github.com/nuwber/rabbitevents/pulls)3MITPHPPHP ^8.2CI passing

Since Oct 25Pushed 3mo ago9 watchersCompare

[ Source](https://github.com/nuwber/rabbitevents)[ Packagist](https://packagist.org/packages/nuwber/rabbitevents)[ GitHub Sponsors](https://github.com/masterjus)[ RSS](/packages/nuwber-rabbitevents/feed)WikiDiscussions 9.x Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (77)Used By (3)

RabbitEvents
============

[](#rabbitevents)

[![Tests Status](https://github.com/nuwber/rabbitevents/workflows/Unit%20tests/badge.svg)](https://github.com/nuwber/rabbitevents/actions?query=branch%3Amaster+workflow%3A%22Unit+tests%22)[![codecov](https://camo.githubusercontent.com/9584c45582e7db5e4b86a9d55128d003a4ad53386fd109a0b38dd92140afaa9b/68747470733a2f2f636f6465636f762e696f2f67682f6e75776265722f7261626269746576656e74732f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d38453943593638363652)](https://codecov.io/gh/nuwber/rabbitevents)[![Total Downloads](https://camo.githubusercontent.com/5f0420dcdef15cbd31c46d07ed4d61ebbfe54fd7af89fa24c5c809232acd4dcf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e75776265722f7261626269746576656e7473)](https://packagist.org/packages/nuwber/rabbitevents)[![Latest Version](https://camo.githubusercontent.com/881c3316318524c361e75efad0d364a9ad3cce846a067e0ce9f4f49b74c408d0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e75776265722f7261626269746576656e7473)](https://packagist.org/packages/nuwber/rabbitevents)[![License](https://camo.githubusercontent.com/1c860fccce18e1454b666e6591bf80907cf6a9f8435e32b8a95b59eacbb925a7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6e75776265722f7261626269746576656e7473)](https://packagist.org/packages/nuwber/rabbitevents)

Let's imagine a use case: a User made a payment. You need to handle this payment, register the user, send him emails, send analytics data to your analysis system, and so on. The modern infrastructure requires you to create microservices that do their specific job and only it: one handles payments, one is for user management, one is the mailing system, one is for analysis. How to let all of them know that a payment succeeded and handle this message? The answer is "To use RabbitEvents".

Once again, the RabbitEvents library helps you publish an event and handle it in another app. It doesn't make sense to use it in the same app because Laravel's Events work better for that.

Demo
----

[](#demo)

[![rabbit-events-demo](https://private-user-images.githubusercontent.com/142213350/278883654-89df6194-e49d-4d58-8286-8932f182da4b.gif?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUyODY4MzgsIm5iZiI6MTc3NTI4NjUzOCwicGF0aCI6Ii8xNDIyMTMzNTAvMjc4ODgzNjU0LTg5ZGY2MTk0LWU0OWQtNGQ1OC04Mjg2LTg5MzJmMTgyZGE0Yi5naWY_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwNDA0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDQwNFQwNzA4NThaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xYzk0ZGYwNmFmNDcyYzhjMmNjMjVkNjAyNTI3YjhiNjU2MDc1MWYyNTEwOWQyMDBkZWNmMzhlMDYxMjA0OGNhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.HWb_GwrZOxkhHJypajv0QRGavrusDkPuQWmHoJi6-go)](https://private-user-images.githubusercontent.com/142213350/278883654-89df6194-e49d-4d58-8286-8932f182da4b.gif?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUyODY4MzgsIm5iZiI6MTc3NTI4NjUzOCwicGF0aCI6Ii8xNDIyMTMzNTAvMjc4ODgzNjU0LTg5ZGY2MTk0LWU0OWQtNGQ1OC04Mjg2LTg5MzJmMTgyZGE0Yi5naWY_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwNDA0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDQwNFQwNzA4NThaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xYzk0ZGYwNmFmNDcyYzhjMmNjMjVkNjAyNTI3YjhiNjU2MDc1MWYyNTEwOWQyMDBkZWNmMzhlMDYxMjA0OGNhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.HWb_GwrZOxkhHJypajv0QRGavrusDkPuQWmHoJi6-go)

Table of Contents
-----------------

[](#table-of-contents)

1. [Installation via Composer](#installation)
    - [Configuration](#configuration)
2. [Upgrade from 8.x to 9.x](#upgrade_8.x-9.x)
3. [Publisher component](#publisher)
4. [Listener component](#listener)
5. [Listeners &amp; Payloads](#listeners-payloads)
6. [Custom Serializers](#custom-serializers)
7. [Extensions](#extensions)
8. [Examples](./examples)
9. [Speeding up RabbitEvents](#speeding-up-rabbitevents)
10. [Testing](#testing)
11. [Non-standard use](#non-standard-use)
12. [License](#license)

Installation via Composer
-----------------------------------------------------------------

[](#installation-via-composer)

You can use Composer to install RabbitEvents into your Laravel project:

```
composer require nuwber/rabbitevents
```

### Configuration

[](#configuration)

After installing RabbitEvents, publish its config and a service provider using the `rabbitevents:install` Artisan command:

```
php artisan rabbitevents:install
```

This command installs the config file at `config/rabbitevents.php` and the Service Provider file at `app/providers/RabbitEventsServiceProvider.php`.

The config file is very similar to the queue connection, but with the separate config, you'll never be confused if you have another connection to RabbitMQ.

```
