PHPackages                             garlic/bus - 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. garlic/bus

ActiveSymfony-bundle[Queues &amp; Workers](/categories/queues)

garlic/bus
==========

Message Bus Bundle uses for communication among microservices through message bus (by default is RabbitMQ)

1.6.17(7y ago)72.2k[1 PRs](https://github.com/garlicservices/bus-bundle/pulls)3MITPHPPHP &gt;=7.1

Since Dec 13Pushed 7y ago7 watchersCompare

[ Source](https://github.com/garlicservices/bus-bundle)[ Packagist](https://packagist.org/packages/garlic/bus)[ RSS](/packages/garlic-bus/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (4)Versions (53)Used By (3)

Garlic message bus
==================

[](#garlic-message-bus)

This bundle allow microservices communicate to each other with RabbitMQ transport by providing message bus.

For correct usage the Bundle must be installed on both ends of communication (current and target services)

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

[](#installation)

Just a couple things are necessary for this bundle works.

### Add garlic/bus bundle to your composer.json

[](#add-garlicbus-bundle-to-your-composerjson)

```
composer require garlic/bus
```

### Run processor as a Daemon (add configuration to your supervisor.conf)

[](#run-processor-as-a-daemon-add-configuration-to-your-supervisorconf)

```
[program:garlic_communication]
command=/var/www/bin/console --env=prod --no-debug enqueue:consume --setup-broker
process_name=%(program_name)s_%(process_num)02d
numprocs=4
autostart=true
autorestart=true
tartsecs=0
user=www-data
redirect_stderr=true
```

Now you can use Garlic Bus

### Optional: You can set timeout which will used to wait for response

[](#optional-you-can-set-timeout-which-will-used-to-wait-for-response)

Set variable REQUEST\_TIMEOUT=30 where 30 is seconds

Usage
-----

[](#usage)

### Common way to use

[](#common-way-to-use)

If you want to get response from current service you have to use 'request' method, like explained below

```
$data = $this->get('communicator') // Or you can call by class name. Example: $this->get(GarlicBus:class)
    ->request('targetServiceName') // Type of message. So far you can use ->request() or ->command() methods. Command provide mesage type that not need response.
    ->post()                       // Set one of REST methods (post, put, delete). Bu default set GET
    ->targetServiceAction(         // CamelCased route where slashes vere changed to upper letter by magic (example: getUser will changed to /get/user)
        array $path = [],          // Path parameters to query (example: ['user' => 1])
        array $query = [],         // Post or Get parameters to the query
        array $headers = []        // Additional headers
    );

```

or the same but using direct rout as a method parameter

```
$data = $this->get('communicator')
    ->request('targetServiceName')
    ->send(
        string $route, // Route to the target service action (example: /user/get)
        array $path = [],
        array $query = [],
        array $headers = []
    );

```

#### Making async batch request with parallel processing

[](#making-async-batch-request-with-parallel-processing)

```
$data = $this->get('communicator')
    ->pool(
        'service1', // Target service name
        '/',        // Route to the target service action (example: /user/get)
        [],         // Path parameters to query
        [],         // Post or Get parameters to the query
        []          // Request headers
    )
    ->pool(
        'service1', // Target service name
        '/',        // Route to the target service action (example: /user/get)
        [],         // Path parameters to query
        [],         // Post or Get parameters to the query
        []          // Request headers
        )
    ->fetch();      // Get response from async queries pool
```

#### Working with files

[](#working-with-files)

make sure you add variables to .env

```
### host url, will be used by another service to get files from current service
HOST_URL=172.18.1.14

###files will be uploaded to this dir
UPLOAD_DIR = public/upload

###should be same for every service using same bus
SCP_USERNAME=www-data
SCP_PASSWORD=KJLgbJ32PIHDJU4

```

upload files from Request

```
 $handler = $this->get('Garlic\Bus\Service\File\FileHandlerService');
 $handler->handleFiles($_FILES['pictures']);

```

get file from another service

```
 $uploader = $this->get('Garlic\Bus\Service\File\ScpFileUploadService');
 $uploader->getFile(['host_url' => '172.18.0.1','origin_name' => '1.jpg','path' => 'public/upload/fsdljkahb.jpg']);

```

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~13 days

Recently: every ~2 days

Total

37

Last Release

2626d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8392050?v=4)[garlic](/maintainers/garlic)[@Garlic](https://github.com/Garlic)

---

Top Contributors

[![Chyslovsky](https://avatars.githubusercontent.com/u/19927239?v=4)](https://github.com/Chyslovsky "Chyslovsky (13 commits)")[![am0nshi](https://avatars.githubusercontent.com/u/7633061?v=4)](https://github.com/am0nshi "am0nshi (12 commits)")[![imaximius](https://avatars.githubusercontent.com/u/5578878?v=4)](https://github.com/imaximius "imaximius (9 commits)")[![demotivationme](https://avatars.githubusercontent.com/u/5822900?v=4)](https://github.com/demotivationme "demotivationme (3 commits)")

---

Tags

bus-bundlecommunicationcomposer-packagegarlic-busmessage-bussymfony-bundlemessage busmicroservicesMicroservises message bus

### Embed Badge

![Health badge](/badges/garlic-bus/health.svg)

```
[![Health](https://phpackages.com/badges/garlic-bus/health.svg)](https://phpackages.com/packages/garlic-bus)
```

###  Alternatives

[simple-bus/message-bus

Generic classes and interfaces for messages and message buses

3465.9M30](/packages/simple-bus-message-bus)[nuwber/rabbitevents

The Nuwber RabbitEvents package

119525.8k4](/packages/nuwber-rabbitevents)[simple-bus/rabbitmq-bundle-bridge

Use OldSoundRabbitMQBundle with SimpleBus/AsynchronousBundle

39874.6k4](/packages/simple-bus-rabbitmq-bundle-bridge)[simple-bus/asynchronous-bundle

Symfony bundle for using SimpleBus/Asynchronous

241.3M6](/packages/simple-bus-asynchronous-bundle)[vinelab/bowler

A Rabbitmq wrapper for Laravel

4660.3k1](/packages/vinelab-bowler)[iamfarhad/laravel-rabbitmq

Native ext-amqp RabbitMQ queue driver for Laravel production workloads with connection pooling, publisher confirms, Horizon support, Octane support, quorum queues, and high-performance workers

3417.9k](/packages/iamfarhad-laravel-rabbitmq)

PHPackages © 2026

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