Git Product home page Git Product logo

php-ddd-cqrs-event-sourcing-symfony-laravel-ecotone's Introduction

Resilient Message-Driven Systems with Ecotone Framework

Objectives

  • To provide a simple example of how to implement Domain Driven Design and Messaging Architecture in PHP.
  • To show how to implement CQRS, Event Sourcing and Hexagonal Architecture in PHP.
  • To show how to implement Resilient and Observable Microservices in PHP.

Why PHP?

Hello traveler, I am Dariusz Gafka author of Ecotone Framework.
With this project, I would like to show you that no matter of how complex your business is, you can build it in PHP.
It does not really matter if we work in E-Commerce, ERP or Finance based systems, we can be sure that system will be resilient, observable and maintainable in long term.
And to make it happen we will use Open-Source frameworks only, like Symfony or Laravel joined with Ecotone.

Why Ecotone?

Ecotone is production ready PHP Framework for building resilient, business oriented systems in PHP.
It provides you with all the tools you need to build Domain Driven Design, CQRS, Event Sourcing and Hexagonal Architecture in PHP.
It integrates with Symfony and Laravel and allows you to connect Services seamlessly using Microservice or Event-Driven architecture.
It's built continuously from 2017 and used in production by many companies.
By providing clean framework separation, resiliency and observability, it provides highest level of confidence for building system in any business domain.

Stack

  • Ecotone - PHP Framework for building resilient, business oriented system in PHP
  • Symfony - PHP Framework for building web applications
  • Laravel - PHP Framework for building web applications
  • RabbitMQ - Message Broker for asynchronous communication
  • Ecotone Pulse - Monitor for any processing errors and recover from failed messages.
  • OpenTelemetry with Jaeger - Distributed Tracing for monitoring and troubleshooting microservices-based distributed systems

Business Domain

Customer Service

  • Customer Service is Laravel+Ecotone application, where customers can report issues. This happens using CQRS combined with Eloquent Models.

Laravel CQRS


  • Whenever new issue is reported, email is send to the with confirmation. This happens using Asynchronous Event Handlers, which are backed by RabbitMQ.

Laravel asynchronous event handling

Backoffice Service

  • Backoffice Service is Symfony+Ecotone application, where employees can be registered and work on the tickets.
    All issues reported by customers are synchronized to Backoffice Service and are correlated with tickets.
    The synchronization between Customer Service and Backoffice Service is done using Events and Distributed Bus for cross service communication via RabbitMQ.

Symfony Microservice


  • Employees can work on the tickets provides information about the status. As we want to know full history, Tickets are Event-Sourced.
    From Event Sourced tickets we build different Read Model Projections, which are used to display information about the ticket.

Tracing and Monitoring

  • The whole communication between Services is monitored and traced using OpenTelemetry with Jaeger.
    OpenTelemetry Jaeger

  • Any issue that happens in the system is reported to Ecotone Pulse, which is used to recover from failed messages.
    Ecotone Pulse

Playing with the demo

Run docker-compose up -d to start all services.

Go to Customer Service to report issue as a customer.
Whenever issue is reported, confirming email will be sent to the customer, which can be found Mailbox.
First time email is sent it's set up for failing, so you can get feeling of working with system that can recover from error messages using Ecotone Pulse.
From Backoffice Service you may start working on ticket, that was correlated with issue reported by customer.
You may also check Jaeger to get full overview of how communication looks like and how each component behave and what is happening.

php-ddd-cqrs-event-sourcing-symfony-laravel-ecotone's People

Contributors

dgafka avatar jclaveau avatar jeijei4 avatar lifinsky avatar tacman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-ddd-cqrs-event-sourcing-symfony-laravel-ecotone's Issues

Bump to Symfony 6.3

I was having trouble running it locally with debug (so I could have a better idea of what was going on), so I upgraded the backoffice to 6.3 and added the debug pack, including the web_profiler.

I'll submit a PR in case you'd like to use it.

Symfony 7 comes out in 2 weeks, that'll be the more interesting one! There are some deprecations, but not really all that many.

Article on deployment

Thanks for releasing this code and the set of articles along with it. I've created many individual Symfony sites, but never an enterprise system with multiple parts communicating with each other, so this is pretty interesting.

Would you consider an article on deployment? (On a related note, are the demo sites live anywhere?) I've been using dokku for my sites, previously I used heroku when they had free apps. Symfony recommends platform.sh, but even $12/month is too expensive for a hobby project.

I've read some about digital ocean's droplets, and a myriad of other solutions, but honestly deployment, especially deployment on the cheap, is still complicated. Your demo app works great ( thx for fixing #3 ) -- but that's with docker compose. If you have experience and opinions with deployment, I'd find it interesting. Thx.

installation error: /data/app/bin/console: no such file

Looks like an interesting framework, thanks for sharing it!

something's amiss in the docker config

git clone [email protected]:ecotoneframework/php-ddd-cqrs-event-sourcing-symfony-laravel-ecotone.git ecotone
cd econtone
docker compose up -d

WARN[0000] The "PWD" variable is not set. Defaulting to a blank string. 

Error response from daemon: failed to create task for container: 
failed to create shim task: OCI runtime create failed: 
runc create failed: unable to start container process: exec: "/data/app/bin/console": 
stat /data/app/bin/console: no such file or directory: unknown

Probably related to the warning. How is PWD set? FWIW, I'm running Ubuntu 22.04, the standard terminal program.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.