ecotone / ecotone
Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Sagas, Projections, Workflows, and Outbox messaging via PHP attributes.
Fund package maintenance!
Requires
- php: ^8.2
- laminas/laminas-code: ^4
- psr/clock: ^1.0
- psr/container: ^1.1.1|^2.0.1
- psr/log: ^2.0|^3.0
- symfony/uid: ^6.4|^7.0|^8.0
Requires (Dev)
- phpstan/phpstan: ^1.8
- phpunit/phpunit: ^10.5|^11.0
- ramsey/uuid: ^4.0
- symfony/expression-language: ^6.4|^7.0|^8.0
- v1.x-dev
- dev-main / 1.309.1.x-dev
- 1.309.1
- 1.309.0
- 1.308.0
- 1.307.0
- 1.306.1
- 1.306.0
- 1.305.0
- 1.304.0
- 1.303.0
- 1.302.1
- 1.302.0
- 1.301.0
- 1.300.2
- 1.300.1
- 1.300.0
- 1.299.2
- 1.299.1
- 1.299.0
- 1.298.0
- 1.297.1
- 1.297.0
- 1.296.0
- 1.295.0
- 1.294.1
- 1.294.0
- 1.293.0
- 1.292.0
- 1.291.1
- 1.291.0
- 1.290.2
- 1.290.1
- 1.290.0
- 1.289.0
- 1.288.0
- 1.287.0
- 1.286.1
- 1.286.0
- 1.285.0
- 1.284.0
- 1.283.0
- 1.282.0
- 1.281.2
- 1.281.1
- 1.281.0
- 1.280.0
- 1.279.0
- 1.278.1
- 1.278.0
- 1.277.3
- 1.277.2
- 1.277.1
- 1.277.0
- 1.276.1
- 1.276.0
- 1.275.3
- 1.275.2
- 1.275.1
- 1.275.0
- 1.274.1
- 1.274.0
- 1.273.0
- 1.272.0
- 1.271.0
- 1.270.1
- 1.270.0
- 1.269.1
- 1.269.0
- 1.268.3
- 1.268.2
- 1.268.1
- 1.268.0
- 1.267.0
- 1.266.0
- 1.265.0
- 1.264.0
- 1.263.0
- 1.262.0
- 1.261.1
- 1.261.0
- 1.260.1
- 1.260.0
- 1.259.3
- 1.259.2
- 1.259.1
- 1.259.0
- 1.258.1
- 1.258.0
- 1.257.0
- 1.256.0
- 1.255.0
- 1.254.1
- 1.254.0
- 1.253.0
- 1.252.0
- 1.251.1
- 1.251.0
- 1.250.0
- 1.249.0
- 1.248.2
- 1.248.1
- 1.248.0
- 1.247.0
- 1.246.0
- 1.245.0
- 1.244.3
- 1.244.2
- 1.244.1
- 1.244.0
- 1.243.0
- 1.242.1
- 1.242.0
- 1.241.0
- 1.240.1
- 1.240.0
- 1.239.1
- 1.239.0
- 1.238.0
- 1.237.0
- 1.236.0
- 1.235.1
- 1.235.0
- 1.234.0
- 1.233.1
- 1.233.0
- 1.232.1
- 1.232.0
- 1.231.4
- 1.231.3
- 1.231.2
- 1.231.1
- 1.231.0
- 1.230.1
- 1.230.0
- 1.229.1
- 1.229.0
- 1.228.1
- 1.228.0
- 1.227.0
- 1.226.0
- 1.225.0
- 1.224.0
- 1.223.0
- 1.222.5
- 1.222.0
- 1.221.1
- 1.221.0
- 1.220.1
- 1.220.0
- 1.219.1
- 1.219.0
- 1.218.0
- 1.217.0
- 1.216.0
- 1.215.1
- 1.215.0
- 1.214.0
- 1.213.2
- 1.213.1
- 1.213.0
- 1.212.0
- 1.211.0
- 1.210.3
- 1.210.2
- 1.210.1
- 1.210.0
- 1.209.1
- 1.209.0
- 1.208.1
- 1.208.0
- 1.207.0
- 1.206.1
- 1.206.0
- 1.205.1
- 1.205.0
- 1.204.2
- 1.204.1
- 1.204.0
- 1.203.8
- 1.203.7
- 1.203.6
- 1.203.5
- 1.203.4
- 1.203.3
- 1.203.2
- 1.203.1
- 1.203.0
- 1.202.2
- 1.202.1
- 1.202.0
- 1.201.4
- 1.200.3
- 1.200.2
- 1.200.1
- 1.200.0
- 1.109.2
- 1.109.1
- 1.109.0
- 1.108.1
- 1.108.0
- 1.107.1
- 1.107.0
- 1.106.0
- 1.105.0
- 1.104.1
- 1.104.0
- 1.103.2
- 1.103.1
- 1.103.0
- 1.102.3
- 1.102.2
- 1.102.1
- 1.102.0
- 1.101.0
- 1.100.0
- 1.99.0
- 1.98.4
- 1.98.3
- 1.98.2
- 1.98.1
- 1.98.0
- 1.97.0
- 1.96.0
- 1.95.1
- 1.95.0
- 1.94.0
- 1.93.0
- 1.92.2
- 1.92.1
- 1.92.0
- 1.91.0
- 1.90.2
- 1.90.1
- 1.90.0
- 1.89.1
- 1.89.0
- 1.88.2
- 1.88.1
- 1.88.0
- 1.87.1
- 1.87.0
- 1.86.0
- 1.85.4
- 1.85.3
- 1.85.2
- 1.85.1
- 1.85.0
- 1.84.0
- 1.83.1
- 1.83.0
- 1.82.0
- 1.81.4
- 1.81.3
- 1.81.2
- 1.81.1
- 1.81.0
- 1.80.3
- 1.80.2
- 1.80.1
- 1.80.0
- 1.79.1
- 1.79.0
- 1.78.0
- 1.77.5
- 1.77.4
- 1.77.3
- 1.77.2
- 1.77.1
- 1.77.0
- 1.76.2
- 1.76.1
- 1.76.0
- 1.74.2
- 1.74.1
- 1.74.0
- 1.73.2
- 1.73.1
- 1.73.0
- 1.72.0
- 1.70.0
- 1.68.0
- 1.67.2
- 1.67.1
- 1.67.0
- 1.66.0
- 1.65.0
- 1.63.0
- 1.62.0
- 1.61.0
- 1.60.0
- 1.59.0
- 1.58.0
- 1.57.0
- 1.56.0
- 1.55.0
- 1.54.0
- 1.53.0
- 1.52.0
- 1.51.1
- 1.51.0
- 1.50.0
- 1.49.2
- 1.49.1
- 1.49.0
- 1.48.2
- 1.48.1
- 1.48.0
- 1.47.2
- 1.47.1
- 1.47.0
- 1.46.1
- 1.46.0
- 1.45.0
- 1.44.3
- 1.44.2
- 1.44.1
- 1.44.0
- 1.43.0
- 1.42.1
- 1.41.1
- 1.41.0
- 1.40.0
- 1.39.0
- 1.38.0
- 1.37.2
- 1.37.1
- 1.37.0
- 1.36.6
- 1.36.5
- 1.36.3
- 1.36.2
- 1.36.1
- 1.36.0
- 1.35.1
- 1.35.0
- 1.34.3
- 1.34.2
- 1.32.2
- 1.32.1
- 1.32.0
- 1.31.1
- 1.31.0
- 1.30.2
- 1.30.1
- 1.30.0
- 1.29.0
- 1.28.0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
- 0.12.15
- 0.12.14
- 0.12.13
- 0.12.12
- 0.12.11
- 0.12.10
- 0.12.9
- 0.12.8
- 0.12.7
- 0.12.6
- 0.12.5
- 0.12.4
- 0.12.3
- 0.12.2
- 0.12.1
- 0.12.0
- 0.11.14
- 0.11.13
- 0.11.12
- 0.11.11
- 0.11.7
- 0.11.6
- 0.11.5
- 0.11.4
- 0.11.3
- 0.11.2
- 0.11.1
- 0.11.0
- 0.10.28
- 0.10.27
- 0.10.26
- 0.10.25
- 0.10.24
- 0.10.23
- 0.10.22
- 0.10.21
- 0.10.20
- 0.10.19
- 0.10.18
- 0.10.17
- 0.10.16
- 0.10.15
- 0.10.14
- 0.10.13
- 0.10.12
- 0.10.11
- 0.10.10
- 0.10.9
- 0.10.8
- 0.10.7
- 0.10.6
- 0.10.5
- 0.10.4
- 0.10.3
- 0.10.2
- 0.10.1
- 0.10.0
- 0.9.68
- 0.9.67
- 0.9.66
- 0.9.65
- 0.9.64
- 0.9.63
- 0.9.62
- 0.9.61
- 0.9.60
- 0.9.59
- 0.9.58
- 0.9.57
- 0.9.56
- 0.9.55
- 0.9.54
- 0.9.53
- 0.9.52
- 0.9.51
- 0.9.50
- 0.9.49
- 0.9.48
- 0.9.47
- 0.9.46
- 0.9.45
- 0.9.44
- 0.9.43
- 0.9.42
- 0.9.41
- 0.9.40
- 0.9.39
- 0.9.38
- 0.9.37
- 0.9.36
- 0.9.35
- 0.9.34
- 0.9.33
- 0.9.32
- 0.9.31
- 0.9.30
- 0.9.29
- 0.9.28
- 0.9.27
- 0.9.26
- 0.9.25
- 0.9.24
- 0.9.23
- 0.9.22
- 0.9.21
- 0.9.20
- 0.9.19
- 0.9.18
- 0.9.17
- 0.9.16
- 0.9.15
- 0.9.14
- 0.9.13
- 0.9.12
- 0.9.11
- 0.9.10
- 0.9.9
- 0.9.8
- 0.9.7
- 0.9.6
- 0.9.5
- 0.9.4
- 0.9.3
- 0.9.2
- 0.9.1
- 0.9.0
- 0.8.2
- 0.8.1
- 0.8.0
- 0.7.3
- 0.7.2
- 0.7.1
- 0.7.0
- 0.6.8
- 0.6.7
- 0.6.6
- 0.6.5
- 0.6.4
- 0.6.3
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.15
- 0.4.14
- 0.4.13
- 0.4.12
- 0.4.11
- 0.4.10
- 0.4.9
- 0.4.8
- 0.4.7
- 0.4.6
- 0.4.5
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.27
- 0.3.26
- 0.3.25
- 0.3.24
- 0.3.23
- 0.3.22
- 0.3.21
- 0.3.20
- 0.3.19
- 0.3.18
- 0.3.17
- 0.3.16
- 0.3.15
- 0.3.14
- 0.3.13
- 0.3.12
- 0.3.11
- 0.3.10
- 0.3.9
- 0.3.8
- 0.3.7
- 0.3.6
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.0
- 0.2.10
- 0.2.9
- 0.2.8
- 0.2.7
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- dev-feature/ecotone-instead-of-core
- dev-feature/read-repo-from-composer-extra
- dev-feature/abstract-event-sourcing
- dev-feature/split-testing
- dev-feature/move-event-sourcing-namespace
- dev-feature/running-behat-tests
This package is auto-updated.
Last update: 2026-04-19 09:48:22 UTC
README
To contribute make use of Ecotone-Dev repository.
Ecotone — the enterprise architecture layer for Laravel and Symfony
One Composer package adds CQRS, Event Sourcing, Sagas, Projections, Workflows, and Outbox messaging to your existing application — all via declarative PHP 8 attributes on the classes you already have. No base classes, no bus wiring, no retry config. The same patterns proven in Java's Spring/Axon and .NET's NServiceBus/MassTransit, brought to PHP without giving up the development speed PHP is known for.
Visit ecotone.tech for the full overview.
See what it looks like
class OrderService { #[CommandHandler] public function placeOrder(PlaceOrder $command, EventBus $eventBus): void { // your business logic $eventBus->publish(new OrderWasPlaced($command->orderId)); } #[QueryHandler('order.getStatus')] public function getStatus(string $orderId): string { return $this->orders[$orderId]->status; } } class NotificationService { #[Asynchronous('notifications')] #[EventHandler] public function whenOrderPlaced(OrderWasPlaced $event, NotificationSender $sender): void { $sender->sendOrderConfirmation($event->orderId); } }
That's the entire setup. No bus configuration. No handler registration. No retry config. No serialization wiring. Ecotone reads your attributes and handles the rest:
- Command, Query, and Event Bus — wired automatically from your attributes
- Event routing — handlers subscribe to events without manual wiring
- Async execution —
#[Asynchronous('notifications')]routes to RabbitMQ, SQS, Kafka, Redis, or DBAL - Failure isolation — each event handler gets its own copy of the message, so one handler's failure never blocks another
- Retries and dead letter — failed messages retry automatically; permanently failed ones go to a dead letter queue you can inspect and replay
- Tracing — OpenTelemetry traces every message across sync and async flows
Test exactly the flow you care about
Extract a specific flow and test it in isolation — only the services you need:
$ecotone = EcotoneLite::bootstrapFlowTesting([OrderService::class]); $ecotone->sendCommand(new PlaceOrder('order-1')); $this->assertEquals('placed', $ecotone->sendQueryWithRouting('order.getStatus', 'order-1'));
Only OrderService is loaded — no notifications, no other handlers. Just the flow you're verifying.
Now bring in the full async flow. Enable an in-memory channel and run it inside the same test process:
$notifier = new InMemoryNotificationSender(); $ecotone = EcotoneLite::bootstrapFlowTesting( [OrderService::class, NotificationService::class], [NotificationSender::class => $notifier], enableAsynchronousProcessing: [ SimpleMessageChannelBuilder::createQueueChannel('notifications') ] ); $ecotone ->sendCommand(new PlaceOrder('order-1')) ->run('notifications'); $this->assertEquals(['order-1'], $notifier->getSentOrderConfirmations());
Swap the in-memory channel for DBAL, RabbitMQ, or Kafka in production — the test stays the same. Ecotone runs the consumer in-process, so switching transports never changes how you test.
What's in the box
| Area | What you get |
|---|---|
| Messaging | Command / Query / Event buses, routing, interceptors, business interfaces (gateways) |
| Domain modelling | Aggregates, Sagas, state-stored or event-sourced — all via attributes |
| Event Sourcing | Event Store, Projections (catch-up, partitioned, streaming), event versioning and upcasting, DCB |
| Workflows | Stateless workflows, orchestrators (routing slip), saga-based process managers |
| Async & resiliency | #[Asynchronous], retries, error channels, dead letter queue with replay, Outbox pattern |
| Observability | OpenTelemetry tracing, Service Map (Enterprise) |
| Multi-tenancy | Per-tenant connections, event stores, and async channels |
| Distribution | Distributed Bus for cross-service events and commands |
| Data protection | Field-level encryption and PII masking for messages |
Install for your framework
Ecotone is not a replacement for Symfony Messenger or Laravel Queue — it's the architecture layer on top. Your existing HTTP layer, transports, and jobs keep working.
Symfony
composer require ecotone/symfony-bundle
Symfony Messenger compatible. Bundle auto-configuration. Doctrine ORM integration. Pure POPOs. → Symfony guide
Laravel
composer require ecotone/laravel
Works with Eloquent and Doctrine. Laravel Queue integration. Auto-discovery, zero config. → Laravel guide
Any PSR-11 framework (Ecotone Lite)
composer require ecotone/ecotone
Full feature set. No framework lock-in. → Ecotone Lite guide
AI-Ready by design
Declarative attributes mean less infrastructure code for your coding agent to read and less boilerplate for it to generate — smaller context, faster iteration, more accurate results.
- MCP Server:
https://docs.ecotone.tech/~gitbook/mcp— Install in VSCode - Agentic Skills — ready-to-use skills that teach any coding agent to correctly write handlers, aggregates, sagas, projections, and tests
- LLMs.txt: ecotone.tech/llms.txt
- Context7: Available via @upstash/context7-mcp
Learn more: AI Integration Guide
Getting started
See the quickstart guide, the full documentation, and the Ecotone Blog.
Prefer runnable code? The quickstart examples cover handlers, aggregates, sagas, event sourcing, projections, outbox, multi-tenancy, and more — each running end-to-end in seconds.
Feature requests and issue reporting
Use issue tracking system for new feature request and bugs. Please verify that it's not already reported by someone else.
Contact
If you want to talk or ask questions about Ecotone
Support Ecotone
If you want to help building and improving Ecotone consider becoming a sponsor:
Tags
PHP, DDD, CQRS, Event Sourcing, Sagas, Projections, Workflows, Outbox, Symfony, Laravel, Service Bus, Event Driven Architecture