DDD, Hexagonal Architecture & CQRS with Symfony and Doctrine

Posted on by

Example of a Symfony application using Domain-Driven Design (DDD) and Command Query Responsibility Segregation (CQRS) principles keeping the code as simple as possible. The whole code can be found here. Environment Setup Needed tools Install Docker Clone this project: git clone https://github.com/salletti/symfony-ddd-example.git Move to the project folder: $ cd symfony-ddd-example Application execution If not already done, install Docker Compose Run docker-compose…

From RabbitMqBundle to PhpEnqueue with Symfony Messenger

Posted on by

Today i try to explain how i migrate from RabbitMqBundle to PhpEnqueue using the Messenger component of Symfony. Stack PHP 7.2 Symfony 4.1 Starting Situation I have well installed RabbitMQ following simple tutorial Symfony 4 and RabbitMQ. So in my configuration file i have the following configuration: #config/packages/old_sound_rabbit_mq.yaml old_sound_rabbit_mq: enable_collector: false connections: default: url: ‘%env(RABBITMQ_URL)%’ lazy:…

CQRS is easy with Symfony 4 and his Messenger Component

Posted on by

Today i want to show you how to use The Messenger Component of Symfony. Very useful when your project implements the CQRS pattern. With an example, simplicity of use and practicality will be evident. Let’s assume that we have a service like this one: <?php namespace App\Domain\Service\Customer; use App\Domain\Command\Customer\DeleteCustomerCommand; use App\Domain\CommandHandler\Customer\DeleteCustomerCommandHandlerInterface; use App\Domain\Exception\Customer\CriteriaNotAllowedException; use App\Domain\Query\Customer\GetCustomerListQuery; use…

Design patterns: Adapter in PHP

Posted on by

Software development is improved every day by new concepts, methodologies, and high quality libraries and frameworks. But even with all these improvements, we cannot prevent change in software development. You may think that your system is designed perfectly to cater to all of its requirements, but there will always be a change request that ruins…