PHPackages                             teamsquad.io/php-event-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. teamsquad.io/php-event-bus

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

teamsquad.io/php-event-bus
==========================

A basic PHP EventBus Library

v3.0.1(10mo ago)211.1k↓37.2%1[3 PRs](https://github.com/teamsquad-io/php-event-bus/pulls)proprietaryPHPPHP &gt;=8.0CI passing

Since Sep 1Pushed 5d ago3 watchersCompare

[ Source](https://github.com/teamsquad-io/php-event-bus)[ Packagist](https://packagist.org/packages/teamsquad.io/php-event-bus)[ RSS](/packages/teamsquadio-php-event-bus/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (8)Versions (33)Used By (0)

PHP EventBus Library
====================

[](#php-eventbus-library)

 **TeamSquad PHP EventBus library package.**

 [ ![Source Code](https://camo.githubusercontent.com/c35cf9305b70b0fb16ca1b9d2f3d32ea2fef7738d65c63fdb33092af6e83a105/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d7465616d73717561642d2d696f2f7068702d2d6576656e742d2d6275732d626c75652e7376673f7374796c653d666c61742d737175617265) ](https://github.com/teamsquad-io/php-event-bus) [ ![Download Package](https://camo.githubusercontent.com/997bf73784f88437a9a6f70b32712118c7559f6c93863015a969ea0222613751/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7465616d73717561642e696f2f7068702d6576656e742d6275732e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365) ](https://packagist.org/packages/teamsquad.io/php-event-bus) [ ![PHP Programming Language](https://camo.githubusercontent.com/68ee24391d4021fd87edef0b60fc12581c877977e9d3ae8f6d769fad9ee317e9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7465616d73717561642e696f2f7068702d6576656e742d6275732e7376673f7374796c653d666c61742d73717561726526636f6c6f72423d253233383839324246) ](https://php.net) [ ![Build Status](https://camo.githubusercontent.com/6b780a830756c58d4fa971a3e9c99361056a08463c136b2638e7ef0339fd7e2e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7465616d73717561642d696f2f7068702d6576656e742d6275732f43493f6c6f676f3d676974687562) ](https://github.com/teamsquad-io/php-event-bus/actions/workflows/ci.yml) [ ![Codecov Code Coverage](https://camo.githubusercontent.com/f6e3ca4e110190cb3ec06eb3dbd87e8ef66029c2ef69cd8783d94afbf7953969/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f67682f7465616d73717561642d696f2f7068702d6576656e742d6275733f6c6162656c3d636f6465636f76266c6f676f3d636f6465636f76267374796c653d666c61742d737175617265) ](https://codecov.io/gh/teamsquad-io/php-event-bus) [ ![Psalm Type Coverage](https://camo.githubusercontent.com/6be2f95d0bd39fae46bbf35d3bbd3e2a3e1f0fbfae383a6f1d3bb58fa9d7b097/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742d7371756172652675726c3d687474707325334125324625324673686570686572642e6465762532466769746875622532467465616d73717561642d696f2532467068702d6576656e742d627573253246636f766572616765) ](https://shepherd.dev/github/teamsquad-io/php-event-bus)

This is the TeamSquad PHP EventBus Library. It's used to publish and listen to events. Installation
------------

[](#installation)

 `composer require teamsquad/php-event-bus`

Development
-----------

[](#development)

### Initialization

[](#initialization)

```
composer install
```

### Run composer scripts

[](#run-composer-scripts)

```
composer test-all     # run test-quality & test-phpunit
composer test-quality # run csrun & psalm & phpstan
composer test-phpunit # run phpunit

composer csrun   # check code style
composer psalm   # run psalm coverage
composer phpstan # run phpstan coverage
```

### Git hooks

[](#git-hooks)

Install the pre-commit hook running:

```
./tools/git-hooks/init.sh
```

### Basic Dockerfile

[](#basic-dockerfile)

If you don't have PHP in your local machine, you can use docker to build an image with `PHP 8.0`.

```
docker build -t php-event-bus .
```

Contributing
------------

[](#contributing)

Feel free to open any PR with your ideas, suggestions or improvements.

Consumer configuration properties
---------------------------------

[](#consumer-configuration-properties)

This library generates and consumes RabbitMQ configurations for your consumers. Each consumer entry contains the following properties:

- amqp: Name of the AMQP connection profile to use (e.g., default, users).
- name: Human/unique identifier for the consumer, typically FQCN::method.
- routing\_key: List of routing keys the queue is bound to (e.g., sample\_event).
- unique: Whether this consumer definition should be treated as non-duplicated across generation/deployment.
- url: HTTP route that maps to a controller endpoint for this consumer.
- queue: Name of the queue to consume from (created/bound according to params when create\_queue is true).
- exchange: Exchange name to bind the queue to (e.g., teamsquad.event\_bus).
- function: Method on the consumer class that will be invoked for each message.
- create\_queue: If true, the queue will be declared/created automatically when setting up the consumer.
- workers: Number of worker processes/consumers to spawn for this consumer (parallelism level).
- params: RabbitMQ queue declaration parameters used when creating/declaring the queue:
    - passive: If true, do not create; only check that the queue exists.
    - durable: If true, the queue will survive a broker restart.
    - exclusive: If true, the queue is restricted to this connection and will be deleted when the connection closes.
    - auto\_delete: If true, the queue will be deleted when the last consumer unsubscribes.
    - nowait: If true, do not wait for a server response to the declare/bind operation.
    - args: Additional arguments for the queue declaration:
        - x-expires (type: int): Message expires (auto-deletes) after this many milliseconds of inactivity.
        - x-ha-policy (type: string): High-availability policy (e.g., all) for classic mirrored queues (legacy RabbitMQ).

Example configuration (high throughput):

```
[
    'amqp'         => 'default',
    'name'         => 'TeamSquad\Tests\SampleConsumerWithWorkers::listenSampleHighThroughputEvent',
    'routing_key'  => ['high_throughput_event'],
    'unique'       => false,
    'url'          => '/_/tests-sampleconsumerwithworkers',
    'queue'        => 'high.throughput.queue',
    'exchange'     => 'teamsquad.event_bus',
    'function'     => 'listenSampleHighThroughputEvent',
    'create_queue' => true,
    'workers'      => 10,
    'params'       => [
        'passive'     => false,
        'durable'     => false,
        'exclusive'   => false,
        'auto_delete' => false,
        'nowait'      => false,
        'args'        => [
            'x-expires'   => ['type' => 'int', 'val' => 300000],
            'x-ha-policy' => ['type' => 'string', 'val' => 'all'],
        ],
    ],
]

```

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance79

Regular maintenance activity

Popularity29

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 57.9% 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 ~54 days

Recently: every ~96 days

Total

21

Last Release

316d ago

Major Versions

v1.3.3 → v2.0.02022-09-29

v2.5.0 → v3.0.02025-08-21

PHP version history (2 changes)v1.0.0PHP &gt;=7.4

v3.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/30cc051d39500e767dfae7d907fb4eed3bcef07f489e2ae2849db13758d8056c?d=identicon)[VtsMedia](/maintainers/VtsMedia)

---

Top Contributors

[![tomasvts](https://avatars.githubusercontent.com/u/4351937?v=4)](https://github.com/tomasvts "tomasvts (162 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (118 commits)")

---

Tags

phpevent bus

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/teamsquadio-php-event-bus/health.svg)

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

###  Alternatives

[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

54681.3k18](/packages/solspace-craft-freeform)

PHPackages © 2026

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