PHPackages                             rabbitevents/listener - 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. rabbitevents/listener

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

rabbitevents/listener
=====================

The Listener component of the RabbitEvents library.

v9.0.0(3mo ago)012.1kMITPHPPHP ^8.2

Since Feb 23Pushed 3mo ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (30)Used By (0)

RabbitEvents Listener
=====================

[](#rabbitevents-listener)

The RabbitEvents Listener component provides an API for handling events published across the application structure. More information is available in the [Nuwber's RabbitEvents documentation](https://github.com/nuwber/rabbitevents).

If you only need to handle events, you can use the RabbitEvents `Listener` separately from the main library.

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

[](#table-of-contents)

1. [Installation via Composer](#installation)
2. [Configuration](#configuration)
3. [Register a Listener](#register)
    - [Registering Listeners via Attributes](#registering-listeners-via-attributes)
    - [Listener Discovery](#listener-discovery)
4. [Defining Listeners](#defining-listeners)
    - [Handling Protobuf Messages](#handling-protobuf-messages)
5. [Middleware](#listener-middleware)
6. [Stopping The Propagation Of An Event](#stopping-propagation)
7. [Console Commands](#commands)
    - [Command `rabbitevents:listen`](#command-listen)
        - [Options](#listen-options)
    - [Command `rabbitevents:list`](#command-list)
    - [Event Discovery Caching](#discovery-caching)
8. [Supervisor Configuration](#supervisor)
9. [Logging](#logging)

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

[](#installation-via-composer)

RabbitEvents Listener can be installed via the Composer package manager:

```
composer require rabbitevents/listener
```

After installing Listener, you can execute the `rabbitevents:install` Artisan command, which will install the RabbitEvents configuration file and `RabbitEventsServiceProvider` into your application:

```
php artisan rabbitevents:install
```

Configuration
-------------------------------------------------------

[](#configuration-)

Details about the configuration are described in the library [documentation](https://github.com/nuwber/rabbitevents#configuration).

Register a Listener
--------------------------------------------------------

[](#register-a-listener-)

The `listen` property of `RabbitEventsServiceProvider` contains an array of all events (keys) and their listeners (values). You can add as many events to this array as your application requires.

You can even register listeners using the `*` as a wildcard parameter, allowing you to catch multiple events with the same listener. Wildcard listeners receive the event name as their first argument and the entire event data array as their second argument.

```
