Giter Club home page Giter Club logo

laravel-ddd-example's Introduction

Hexagonal Architecture, DDD & CQRS in Laravel PHP

Laravel 8 PHP Docker MySql Terraform CircleCI GithubActions

This is a monorepo containing a PHP application using Domain-Driven Design (DDD) and Command Query Responsibility Segregation (CQRS) principles.

It's a basic implementation of a Kanban manager (at this moment, just only manages Board entity with id and name attributes)

The main objective of this implementation is to use Laravel as backend framework but instead of using MVC architecture, go for DDD and Hexagonal.

Report a bug · Request a feature

CI pipeline status

Installation

Requirements

Environment

  • Clone this project: git clone https://github.com/mguinea/laravel-ddd-example laravel-ddd-example
  • Move to the project folder: cd laravel-ddd-example

Execution

Install all the dependencies and bring up the project with Docker executing:

make build
make up
make migrate

Then you'll have 1 app available (an API):

API Documentation

Open API documentation here

Postman API collection here

Tests

Execute all test suites: make tests

Project structure and explanation

Root Folders

apps

Here are our implementations of the code we have in our base (src). Here can be any framework, etc...

etc

etc is for "Editable Text Configurations". So here we can put any configuration by xml, yaml etc... like Docker setup.

src

src is for "Source". Here we put all our code base being as independent as possible of any implementation (except is there is in infrastructure subfolder).

Bounded contexts

Kanban: Place where the main functionality is implemented. Management of boards...

Architecture and Structure

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

Kanban bounded context containing Board module and Shared bonded context.

$ tree -L 3 src

src
├── Kanban
│   └── Board
│       ├── Application
│       ├── Domain
│       └── Infrastructure
└── Shared
    ├── Domain
    │   ├── Aggregate
    │   └── Bus
    └── Infrastructure
        └── Bus

Repositories

Repository pattern

Our repositories try to be as simple as possible usually only containing basic CRUD methods (delete, find, save and list using criteria pattern).

CQRS

Symfony Messenger has been used to implement commands, queries and events.

Infrastructure

RabbitMQ

There is a service with RabbitMQ to manage queues. You can access it going to http://localhost:15672 and using guest as username and password.

References

laravel-ddd-example's People

Contributors

mguinea avatar

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.