PHPackages                             letsgoi/laravel-domain-events-messaging - 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. letsgoi/laravel-domain-events-messaging

ActiveLibrary[Queues &amp; Workers](/categories/queues)

letsgoi/laravel-domain-events-messaging
=======================================

Package to publish/consume domain events messages from Laravel apps

4.0.0(1y ago)25.7kMITPHPPHP ^8.3CI failing

Since Apr 27Pushed 1y ago3 watchersCompare

[ Source](https://github.com/letsgoi/laravel-domain-events-messaging)[ Packagist](https://packagist.org/packages/letsgoi/laravel-domain-events-messaging)[ Docs](https://github.com/letsgoi/laravel-domain-events)[ RSS](/packages/letsgoi-laravel-domain-events-messaging/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (9)Dependencies (6)Versions (11)Used By (0)

Laravel Domain Events Messaging
===============================

[](#laravel-domain-events-messaging)

This package allows to send/consume domain message events from your laravel app. This can be used to communicate between services or in the same application via queues.

It's divided in two main elements:

- **Publisher**: To publish messages on queue.
- **Consumer**: Read messages from queue and execute jobs/events.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.3
- Laravel &gt;= 10.0

Instalation
-----------

[](#instalation)

- Require package with composer:

```
composer require letsgoi/laravel-domain-events-messaging
```

- Publish configuration:

```
php artisan vendor:publish --provider="Letsgoi\DomainEventsMessaging\DomainEventsMessagingServiceProvider" --tag="config"
```

Service Provider will be automatically registered, however if you want to add it manually, you must add this to your `config/app.php` file:

```
'providers' => [
    // ...
    Letsgoi\DomainEventsMessaging\DomainEventsMessagingServiceProvider::class,
];
```

Usage
-----

[](#usage)

### Publisher

[](#publisher)

Domain Events Messaging Publisher will publish messages to exchange defined on config file (on `DOMAIN_EVENTS_PUBLISHER_CONNECTION` env variable).

#### Publishing messages

[](#publishing-messages)

Just use `publish` method on `DomainEventsMessagingPublisher` facade to send messages with event type:

```
DomainEventsMessagingPublisher::publish('message.subject', 'message content');
```

### Consumer

[](#consumer)

Domain Events Messaging Consumer will consume messages from the queue driver defined on config file (on `DOMAIN_EVENTS_CONSUMER_CONNECTION` env variable) and launch jobs/events setted on config file (`config/domain_events_messaging.php`) by message subject.

#### Defining events:

[](#defining-events)

On config file you must set the messages to be consumed and the job/event to be dispatched when this message will be consumed:

```
'consumer' => [
    // ...

    'events' => [
        'message.subject' => Event::class,
        'message.other' => Job::class,
        // ...
    ]
]
```

When consumer read some message with subject defined on this config, the job/event will be launch with the `array $payload` setted on his constructor.

#### Jobs/Events

[](#jobsevents)

The class defined on config file to be dispatched on message, could be:

- Laravel Job: It must use the `Illuminate\Foundation\Bus\Dispatchable` trait.
- Laravel Event: It must use the `Illuminate\Foundation\Events\Dispatchable` trait.

Both will be receive on his constructor message as string:

```
public function __construct(string $message)
```

You can queue the jobs as a normal job on Laravel.

#### Running consumer:

[](#running-consumer)

To run the consumer as a daemon you must execute:

```
php artisan domain-events:consume
```

This task should be monitored with some like supervisor to be running on fails.

Drivers
-------

[](#drivers)

### AWS SNS-SQS

[](#aws-sns-sqs)

To use AWS SNS or AWS SQS driver, you must follow this instructions:

- Add (and fill) this variables on your .env file:

```
# AWS IAM
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=

# SNS
AWS_DOMAIN_EVENTS_SNS_TOPIC_ARN=

# SQS
AWS_SQS_DOMAIN_EVENTS_URL=

```

Testing
-------

[](#testing)

Run tests:

```
composer test
```

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

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License
-------

[](#license)

[MIT](./LICENSE.md)

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance44

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~220 days

Recently: every ~306 days

Total

9

Last Release

446d ago

Major Versions

0.1.1 → 1.0.02020-05-07

1.3.0 → 2.0.02023-05-11

2.0.0 → 3.0.02024-07-10

3.0.0 → 4.0.02025-02-27

PHP version history (5 changes)0.1.0PHP &gt;=7.2

1.2.0PHP ^7.2|^8.0

1.3.0PHP ^7.4|^8.0

2.0.0PHP ^8.1

3.0.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/21895df4b67dd1b486aa23eee404be73842e53660da0cb4d6e43037462fece48?d=identicon)[letsgoi](/maintainers/letsgoi)

---

Top Contributors

[![adri-navarro](https://avatars.githubusercontent.com/u/9930545?v=4)](https://github.com/adri-navarro "adri-navarro (2 commits)")

---

Tags

laraveleventsqueuemessagesdomaincommunicationgoiletsgoi

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/letsgoi-laravel-domain-events-messaging/health.svg)

```
[![Health](https://phpackages.com/badges/letsgoi-laravel-domain-events-messaging/health.svg)](https://phpackages.com/packages/letsgoi-laravel-domain-events-messaging)
```

###  Alternatives

[nuwber/rabbitevents

The Nuwber RabbitEvents package

120515.8k3](/packages/nuwber-rabbitevents)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

3786.5k](/packages/harris21-laravel-fuse)[pmatseykanets/artisan-beans

Easily manage your Beanstalkd job queues right from the Laravel artisan command

4482.1k](/packages/pmatseykanets-artisan-beans)[pod-point/laravel-aws-pubsub

A Laravel broadcasting driver and queue driver that broadcasts and listens to published events utilising AWS SNS, EventBridge and SQS.

1096.1k](/packages/pod-point-laravel-aws-pubsub)

PHPackages © 2026

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