Download the PHP package rabbitevents/symfony-bundle without Composer

On this page you can find all versions of the php package rabbitevents/symfony-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package symfony-bundle

RabbitEvents Symfony Bundle

Build Status Latest Stable Version Total Downloads Latest Version License

Publish and listen to events across microservices via RabbitMQ โ€” for Symfony.

This bundle provides inter-application event communication using RabbitMQ topic exchanges. Events published by any microservice are routed across services based on routing keys, with full support for wildcard routing.


Features


Table of Contents


Installation

Install the bundle via Composer:

If you don't use Symfony Flex, enable the bundle in config/bundles.php:


Quick Start

1. Configure Connection

Create config/packages/rabbitevents.yaml:

Add environment variables to your .env:

2. Create and Publish an Event

3. Create a Listener

4. Start Listening


Publishing Events

1. Event Classes (AbstractPublishableEvent)

Extending AbstractPublishableEvent gives your event a static-style $event->publish() helper:

2. Publishing via Dependency Injection

For clean architecture and easier unit testing, inject RabbitEvents\Bundle\Publisher directly into your services:

3. Implementing ShouldPublish Directly

If you prefer not to extend AbstractPublishableEvent, implement ShouldPublish:


Listening for Events

Listeners are automatically discovered and registered via the #[AsRabbitListener] attribute.

Class-Level Listener Attribute

Place #[AsRabbitListener] on the class. The handle() method (or __invoke()) will be called when the event arrives:

Method-Level Listener Attributes

You can group multiple event handlers in a single service class by annotating individual methods:

Wildcard Listeners

RabbitEvents uses RabbitMQ topic exchanges, supporting wildcard matching in routing keys:

Failure Handling (failed() callback)

If an exception occurs during processing and retry attempts are exhausted, the worker calls the failed(\Throwable $e) method on your listener:


Console Commands

rabbitevents:listen

Start a background worker to consume events from RabbitMQ:

Available Options

Option Description Default
--service, -s Service name used to isolate queue names per service app
--memory Memory limit in MB before worker gracefully restarts 128
--timeout Max processing timeout in seconds per message 60
--tries Max retry attempts for failed messages 0 (no retries)
--sleep Sleep delay in seconds between retries 1

rabbitevents:list

List all discovered RabbitEvents listeners and their routing keys:


Configuration

Full options reference for config/packages/rabbitevents.yaml:


Serialization

JSON (Default)

The default serializer encodes arrays and objects as JSON and decodes them to associative arrays in your listener's handle(array $payload) method.

Protobuf Support

If google/protobuf is installed in your project, the Protobuf serializer is automatically registered:

Custom Serializers

To register a custom serializer, implement RabbitEvents\Bundle\Contract\Serializer and tag it:


Testing

Use the PublishableEventTesting trait in PHPUnit tests to fake event publication without connecting to RabbitMQ:


Examples

Check the examples/ directory for complete, ready-to-use examples:


License

This package is open-sourced software licensed under the MIT license.


All versions of symfony-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
enqueue/amqp-lib Version ^0.10
psr/log Version ^3.0
symfony/config Version ^7.0|^8.0
symfony/console Version ^7.0|^8.0
symfony/dependency-injection Version ^7.0|^8.0
symfony/event-dispatcher Version ^7.0|^8.0
symfony/framework-bundle Version ^7.0|^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rabbitevents/symfony-bundle contains the following files

Loading the files please wait ...