PHPackages                             aztech/events - 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. aztech/events

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

aztech/events
=============

PHP Event Library with AMQP, WAMP, Stomp, Redis, PDO, ... support

v1.1.0(11y ago)2223[1 issues](https://github.com/aztech-dev/events/issues)PHP

Since Feb 6Pushed 11y ago2 watchersCompare

[ Source](https://github.com/aztech-dev/events)[ Packagist](https://packagist.org/packages/aztech/events)[ RSS](/packages/aztech-events/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (4)Dependencies (7)Versions (6)Used By (0)

aztech/events
=============

[](#aztechevents)

Important notice
----------------

[](#important-notice)

This package is the main repository for aztech/events, and does not contain any code. Please refer to the composer.json to view the list of the packages provided by this package.

It **imports all extra plugins** into your dependencies, and it **highly recommended** to not depend on this package, as it is present mostly for backwards compatibility.

Stability
---------

[](#stability)

[![Latest Stable Version](https://camo.githubusercontent.com/81d25aa087bd50d4451864ab24235bcbd478f388fbd09a3b1c8beeb70c183ebf/68747470733a2f2f706f7365722e707567782e6f72672f617a746563682f6576656e74732f762f737461626c652e706e67)](https://packagist.org/packages/aztech/events)[![Latest Unstable Version](https://camo.githubusercontent.com/8ce9ebfeda8a4db9461bb02c6134c73023658ff1e4909b208fe8678809e60d89/68747470733a2f2f706f7365722e707567782e6f72672f617a746563682f6576656e74732f762f756e737461626c652e706e67)](https://packagist.org/packages/aztech/events)

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

[](#installation)

### Via Composer

[](#via-composer)

Composer is the only supported way of installing *aztech/events* . Don't know Composer yet ? [Read more about it](https://getcomposer.org/doc/00-intro.md).

```
$ composer require "aztech/events":"~1"
```

Autoloading
-----------

[](#autoloading)

Add the following code to your bootstrap file :

```
require_once 'vendor/autoload.php';
```

Concepts
--------

[](#concepts)

*aztech/events* aims to provide a solid foundation to build event driven architectures in PHP.

The current mainstream approach in existing libraries is currently to produce and consume events within the same process (for example, during a single HTTP request). While this is fine in most cases, it does not fit in well with distributed systems, where events need to cross process/host boundaries. This library attempts to solve that by decoupling totally the publish and the subscribe processes through the use of *event channels*.

An event channel is simply any resource to which data can be written to and retrieved later (read TCP socket, memory, shared memory, files, message queues...). When an event is published, it is serialized and written to a channel, instead of being dispatched to the event subscribers.

On the other end of the channel, a consumer is responsible for reading incoming events (synchronously or not, depending on the channel type used) and pushing them to a standard event dispatcher. The dispatcher used by the consumer is responsible for dispatching received events to your handlers.

This means you can publish and dispatch events using the following methods :

- [Native plugins](https://github.com/aztech-dev/event-bus-core-plugins)
    - [File](https://github.com/aztech-dev/event-bus-core-plugins/blob/master/doc/File.md)
    - [Socket](https://github.com/aztech-dev/event-bus-core-plugins/blob/master/doc/Socket.md)
    - [Memory](https://github.com/aztech-dev/event-bus-core-plugins/blob/master/doc/Memory.md)
    - [Database via PDO (untested)](https://github.com/aztech-dev/event-bus-core-plugins/blob/master/doc/Pdo.md)
- [Extra plugins](https://github.com/aztech-dev/event-bus-extra-plugins)
    - [AMQP](https://github.com/aztech-dev/event-bus-extra-amqp)
    - [Mixpanel](https://github.com/aztech-dev/event-bus-extra-mixpanel)
    - [STOMP](https://github.com/aztech-dev/event-bus-extra-stomp)
    - [Redis](https://github.com/aztech-dev/event-bus-extra-redis)
    - [Wamp](https://github.com/aztech-dev/event-bus-extra-wamp)
    - [ZMQ](https://github.com/aztech-dev/event-bus-extra-zmq)

If you want to create and publish events, you will need to use a **publisher**. If you want to consume published events, you will need to use a **processor**. A processor is responsible for receiving events via whatever transport it uses. The library provides hooks to which you can bind **subscribers**, which are simple event handlers.

Optionally, the library provides an Application object to which you can easily bind subscribers.

Event matching rules
--------------------

[](#event-matching-rules)

In *events*, all events are published and subscribed to on topic basis. An event has to expose a category property, which must return the topic to which the event belongs. It can be any word, or chain of words separated by dots. Each dot indicates a sub-topic.

Subscribers can then choose to subscribe to topic on an exact match basis, or by using wildcards to subscribe to multiple events.

### Using wildcards

[](#using-wildcards)

> **tl;dr** Use '#' to match absolutely anything, '\*' to match exactly one unknown word.

Event category matching actually follows the [AMQP topic specification](https://svn.apache.org/repos/asf/qpid/trunk/qpid/specs/apache-filters.xml#section-legacy-amqp), which is quite flexible :

> The legacy-amqp-topic-binding filter consists of a described string value. The value value described by the type is interpreted as a pattern to match against the subject field of the Properties section of the message being evaluated.
>
> The pattern is formed using zero or more tokens, with each token delimited by the "." character. The tokens "#" and "\*" have special meanings. The token consisting of the single character "\*" matches a single word in the subject field. The token consisting of the single character "#" matches zero or more words in the subject field. Thus the filter value "\*.stock.#" would match the subjects "usd.stock" and "eur.stock.db" but not "stock.nasdaq".

Basically, a topic name must be composed of letters and/or numbers and dashes. Sub-topics can be specified by using dots :

```
topic
topic.subtopic
topic.subtopic.leaf

```

You can use '\*' as a wildcard to match exactly one component in a topic :

```
topic.* will match with topic.subtopic, but not with topic nor topic.subtopic.leaf

```

There is also '#', which means 0 or more components :

```
# will match all possible topics.
topic.# will match topic, topic.subtopic, and topic.subtopic.leaf and any subtopic of topic no matter its nesting level
topic.#.leaf will match topic.subtopic.leaf and topic.other.leaf and many others, but not topic.subtopic.other

```

To get check the latest truth table of event matching, please refer to the source of `Aztech\Events\Tests\Unit\CategoryMatchTruthTable`.

Usage
-----

[](#usage)

For simplicity, there are factories available to create publishers and dispatchers.

Listed below are examples for some of the providers. The full documentation is available [here](https://github.com/aztech-dev/events/tree/master/doc/plugins.md).

### Basic usage

[](#basic-usage)

```
require_once 'vendor/autoload.php';

use \Aztech\Events\Event;
use \Aztech\Events\Bus\Events;
use \Aztech\Events\Bus\Plugins\Plugins;

Plugins::loadMemoryPlugin();

$publisher = Events::createPublisher('memory');
$processor = Events::createProcessor('memory');

// Subscribe to all events using a wildcard filter
$processor->on('#', function (Event $event) {
    echo 'Received a new event : ' . $event->getCategory();
});

$event = \Aztech\Events\Events::create('category', array('property' => 'value'));
$publisher->publish($event);
```

Checkout the provider specific documentations for more usage examples.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 98% 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 ~71 days

Total

4

Last Release

4269d ago

Major Versions

v0.2 → v1.0.02014-08-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/58d21270e5d40f7ee05bb875b2442496ffd38cec041f7fdcc507b8b040f7e7f8?d=identicon)[thibaud-evaneos](/maintainers/thibaud-evaneos)

---

Top Contributors

[![aztech-dev](https://avatars.githubusercontent.com/u/93562568?v=4)](https://github.com/aztech-dev "aztech-dev (49 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

eventeventsdispatchaztech

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/aztech-events/health.svg)

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

###  Alternatives

[doctrine/event-manager

The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.

6.1k501.1M115](/packages/doctrine-event-manager)[laminas/laminas-eventmanager

Trigger and listen to events within a PHP application

1.0k69.8M225](/packages/laminas-laminas-eventmanager)[tormjens/eventy

The WordPress filter/action system in Laravel

438912.9k16](/packages/tormjens-eventy)[zumba/symbiosis

Symbiosis, event structure for bootstrapping plugins.

1360.4k1](/packages/zumba-symbiosis)[codefog/contao-events_subscriptions

events\_subscriptions extension for Contao Open Source CMS

102.7k](/packages/codefog-contao-events-subscriptions)

PHPackages © 2026

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