maximegosselin/messager

Lightweight and unrestrictive Message Bus implementation.

1.1.0 2017-08-04 15:34 UTC

This package is auto-updated.

Last update: 2022-02-27 00:38:44 UTC


README

Latest Version Build Status Software License

Messager is a lightweight and unrestrictive internal messaging framework for PHP 7.

It can be used in Event-Driven applications to build more specialized components like Command Bus or Event Dispatcher.

System Requirements

PHP 7.1 or later.

Install

Install using Composer:

$ composer require maximegosselin/messager

Messager is registered under the MaximeGosselin\Messager namespace.

Documentation

Usage overview

use MaximeGosselin\Messager\MessageBus;

// Create a message bus with a core message handler
$bus = new MessageBus(new MyApp\MyMessageHandler());

// Push a middleware to the stack
$bus = $bus->withMiddleware(new MyApp\MyMiddleware());

// Send a message
$bus->handle(new MyApp\MyMessage());

Examples

See /examples for real-world implementation examples.

Tests

Run the following command from the project folder.

$ vendor/bin/phpunit

License

The MIT License (MIT). Please see LICENSE for more information.