All Projects → CodelyTV → Php Ddd Example

CodelyTV / Php Ddd Example

Licence: mit
🐘🎯 Hexagonal Architecture + DDD + CQRS in PHP using Symfony 5

Programming Languages

PHP
23972 projects - #3 most used programming language
Twig
543 projects
Gherkin
971 projects
Makefile
30231 projects

Projects that are alternatives of or similar to Php Ddd Example

typescript-ddd-example
🔷🎯 TypeScript DDD Example: Complete project applying Hexagonal Architecture and Domain-Driven Design patterns
Stars: ✭ 607 (-69.03%)
Mutual labels:  cqrs, ddd, domain-driven-design, codelytv, hexagonal-architecture, codely
typescript-ddd-course
🔷🔖 TypeScript DDD Course: Learn Domain-Driven Design in TS lesson by lesson
Stars: ✭ 28 (-98.57%)
Mutual labels:  cqrs, ddd, domain-driven-design, codelytv, hexagonal-architecture, codely
csharp-ddd-skeleton
🦈✨ C# DDD Skeleton: Bootstrap your new C# projects applying Hexagonal Architecture and Domain-Driven Design patterns
Stars: ✭ 67 (-96.58%)
Mutual labels:  cqrs, ddd, codelytv, hexagonal-architecture, codely
Clean Architecture Manga
🌀 Clean Architecture with .NET6, C#10 and React+Redux. Use cases as central organizing structure, completely testable, decoupled from frameworks
Stars: ✭ 3,104 (+58.37%)
Mutual labels:  microservice, domain-driven-design, monorepo, hexagonal-architecture
Kreta
Modern project management solution
Stars: ✭ 177 (-90.97%)
Mutual labels:  symfony, ddd, cqrs, domain-driven-design
Event Sourcing Jambo
An Hexagonal Architecture with DDD + Aggregates + Event Sourcing using .NET Core, Kafka e MongoDB (Blog Engine)
Stars: ✭ 159 (-91.89%)
Mutual labels:  microservice, ddd, cqrs, domain-driven-design
Msgphp
Reusable domain layers. Shipped with industry standard infrastructure.
Stars: ✭ 182 (-90.71%)
Mutual labels:  doctrine, symfony, cqrs, domain-driven-design
ftgogo
FTGOGO - event-driven architecture demonstration application using edat
Stars: ✭ 82 (-95.82%)
Mutual labels:  cqrs, ddd, monorepo, hexagonal-architecture
educational-platform
Modular Monolith Java application with DDD
Stars: ✭ 124 (-93.67%)
Mutual labels:  cqrs, ddd, domain-driven-design, hexagonal-architecture
Practical Clean Ddd
A simplified and effortless approach to get started with Domain-driven Design, Clean Architecture, CQRS, and Microservices patterns
Stars: ✭ 28 (-98.57%)
Mutual labels:  microservice, ddd, cqrs, microservices-architecture
DDD
Domain-Driven Design example
Stars: ✭ 116 (-94.08%)
Mutual labels:  cqrs, ddd, domain-driven-design, hexagonal-architecture
Bicing Api
Get statistics and locations of bicycle stations through REST API
Stars: ✭ 149 (-92.4%)
Mutual labels:  symfony, ddd, cqrs, behat
Event Sourcing Castanha
An Event Sourcing service template with DDD, TDD and SOLID. It has High Cohesion and Loose Coupling, it's a good start for your next Microservice application.
Stars: ✭ 68 (-96.53%)
Mutual labels:  microservice, ddd, cqrs, domain-driven-design
go-hexagonal http api-course
Ejemplos del curso de API HTTP en Go aplicando Arquitectura Hexagonal
Stars: ✭ 78 (-96.02%)
Mutual labels:  ddd, domain-driven-design, codelytv, hexagonal-architecture
Hexagonal Architecture Acerola
An Hexagonal Architecture service template with DDD, CQRS, TDD and SOLID using .NET Core 2.0. All small features are testable and could be mocked. Adapters could be mocked or exchanged.
Stars: ✭ 293 (-85.05%)
Mutual labels:  microservice, ddd, cqrs, domain-driven-design
Symfony Demo App
A Symfony demo application with basic user management
Stars: ✭ 122 (-93.78%)
Mutual labels:  doctrine, symfony, cqrs, domain-driven-design
Pitstop
This repo contains a sample application based on a Garage Management System for Pitstop - a fictitious garage. The primary goal of this sample is to demonstrate several software-architecture concepts like: Microservices, CQRS, Event Sourcing, Domain Driven Design (DDD), Eventual Consistency.
Stars: ✭ 708 (-63.88%)
Mutual labels:  ddd, cqrs, microservices-architecture
Hookphp
HookPHP基于C扩展搭建内置AI编程的架构系统-支持微服务部署|热插拔业务组件-集成业务模型|权限模型|UI组件库|多模板|多平台|多域名|多终端|多语言-含常驻内存|前后分离|API平台|LUA QQ群:679116380
Stars: ✭ 575 (-70.66%)
Mutual labels:  microservice, laravel, symfony
Symfony 5 Es Cqrs Boilerplate
Symfony 5 DDD ES CQRS backend boilerplate
Stars: ✭ 759 (-61.28%)
Mutual labels:  symfony, ddd, cqrs
Rails event store
A Ruby implementation of an Event Store based on Active Record
Stars: ✭ 947 (-51.68%)
Mutual labels:  ddd, cqrs, domain-driven-design

🐘🎯 Hexagonal Architecture, DDD & CQRS in PHP

codely.tv CodelyTV Courses Symfony 5.0 CI pipeline status

Example of a PHP application using Domain-Driven Design (DDD) and Command Query Responsibility Segregation (CQRS) principles keeping the code as simple as possible.

Take a look, play and have fun with this. Stars are welcome 😊

View Demo · Report a bug · Request a feature

🚀 Environment Setup

🐳 Needed tools

  1. Install Docker
  2. Clone this project: git clone https://github.com/CodelyTV/php-ddd-example php-ddd-example
  3. Move to the project folder: cd php-ddd-example

🛠️ Environment configuration

  1. Create a local environment file (cp .env .env.local) if you want to modify any parameter

🔥 Application execution

  1. Install all the dependencies and bring up the project with Docker executing: make build
  2. Then you'll have 3 apps available (2 APIs and 1 Frontend):
    1. Mooc Backend: http://localhost:8030/health-check
    2. Backoffice Backend: http://localhost:8040/health-check
    3. Backoffice Frontend: http://localhost:8041/health-check

Tests execution

  1. Install the dependencies if you haven't done it previously: make deps
  2. Execute PHPUnit and Behat tests: make test

👩‍💻 Project explanation

This project tries to be a MOOC (Massive Open Online Course) platform. It's decoupled from any framework, but it has some Symfony and Laravel implementations.

⛱️ Bounded Contexts

  • Mooc: Place to look in if you wanna see some code 🙂. Massive Open Online Courses public platform with users, videos, notifications, and so on.
  • Backoffice: Here you'll find the use cases needed by the Customer Support department in order to manage users, courses, videos, and so on.

🎯 Hexagonal Architecture

This repository follows the Hexagonal Architecture pattern. Also, it's structured using modules. With this, we can see that the current structure of a Bounded Context is:

$ tree -L 4 src

src
|-- Mooc // Company subdomain / Bounded Context: Features related to one of the company business lines / products
|   `-- Videos // Some Module inside the Mooc context
|       |-- Application
|       |   |-- Create // Inside the application layer all is structured by actions
|       |   |   |-- CreateVideoCommand.php
|       |   |   |-- CreateVideoCommandHandler.php
|       |   |   `-- VideoCreator.php
|       |   |-- Find
|       |   |-- Trim
|       |   `-- Update
|       |-- Domain
|       |   |-- Video.php // The Aggregate of the Module
|       |   |-- VideoCreatedDomainEvent.php // A Domain Event
|       |   |-- VideoFinder.php
|       |   |-- VideoId.php
|       |   |-- VideoNotFound.php
|       |   |-- VideoRepository.php // The `Interface` of the repository is inside Domain
|       |   |-- VideoTitle.php
|       |   |-- VideoType.php
|       |   |-- VideoUrl.php
|       |   `-- Videos.php // A collection of our Aggregate
|       `-- Infrastructure // The infrastructure of our module
|           |-- DependencyInjection
|           `-- Persistence
|               `--MySqlVideoRepository.php // An implementation of the repository
`-- Shared // Shared Kernel: Common infrastructure and domain shared between the different Bounded Contexts
    |-- Domain
    `-- Infrastructure

Repository pattern

Our repositories try to be as simple as possible usually only containing 2 methods search and save. If we need some query with more filters we use the Specification pattern also known as Criteria pattern. So we add a searchByCriteria method.

You can see an example here and its implementation here.

Aggregates

You can see an example of an aggregate here. All aggregates should extend the AggregateRoot.

Command Bus

There is 1 implementations of the command bus.

  1. Sync using the Symfony Message Bus

Query Bus

The Query Bus uses the Symfony Message Bus.

Event Bus

The Event Bus uses the Symfony Message Bus. The MySql Bus uses a MySql+Pulling as a bus. The RabbitMQ Bus uses RabbitMQ C extension.

📱 Monitoring

Every time a domain event is published it's exported to Prometheus. You can access to the Prometheus panel here.

🤔 Contributing

There are some things missing (add swagger, improve documentation...), feel free to add this if you want! If you want some guidelines feel free to contact us :)

🤩 Extra

This code was shown in the From framework coupled code to #microservices through #DDD talk and doubts where answered in the DDD y CQRS: Preguntas Frecuentes video.

🎥 Used in the CodelyTV Pro courses:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].