DEV Community

Fluttershy
Fluttershy

Posted on

My first open-source project: The Messaging Mediator

Hello fellow coders,

I want to show you my first open-source project. It is a relatively small library for PHP that enables you to model a more beautiful domain model using DDD practices.

What it does

The messaging mediator hooks into your message bus, giving you the ability to yield messages from your application and domain layer, including message handlers, aggregates, value objects, domain services, etc.

Publish domain events, dispatch commands and issue queries and get their results without any dependency to your message bus.

Look at the repository's README file to see how you can use it (section "Use Cases")

GitHub logo coajaxial / messaging-mediator

Send messages directly from your domain model without any dependencies

Messaging Mediator

Psalm Unit tests Integration tests Latest Stable Version Total Downloads License

The messaging mediator hooks into your message bus, giving you the ability to yield messages from your application and domain layer, including message handlers, aggregates, value objects, domain services, etc.

Publish domain events, dispatch commands and issue queries and get their results without any dependency to your message bus.

Installation

⚠️ This library has no stable release! It currently only provides a middleware for Symfony's messenger component and testing aids for PHPUnit.

composer require coajaxial/messaging-mediator:@dev

Next, you need to configure your message bus to use the mediator.

Symfony messenger component (manually)

<?php
use Coajaxial\MessagingMediator\Adapter\Messenger\MessageBusAdapter
use Coajaxial\MessagingMediator\Adapter\Messenger\MessagingMediatorMiddleware;
use Coajaxial\MessagingMediator

If you have any questions about my project, please feel free to ask them here!

Top comments (3)

Collapse
 
coajaxial profile image
Fluttershy

One thing I forgot to mention: This project is under development! It currently lacks a full bundle for Symfony's messenger component (But an adapter is already there, you just have to configure it manually) and testing aids that help you unit test your domain model using this kind of messaging technique.

Collapse
 
siatwe profile image
Simon Weis • Edited

Never in my life have I seen a more useful and beautiful open source project than this one! Tears of joy run down my cheek when I think about using it. I once heard that it is the most beautiful thing in the world to have your own child. But I believe that the joy of using these brilliant lines of code will top this feeling.

Collapse
 
coajaxial profile image
Fluttershy

Shut up, Simon :DD