A DDD microservice did in laravel, to test infrastructure

Overview

Microservice1

This microservice is one of the two that go together in the https://github.com/pegons/microservice_infrastructure repository. Remember to put it at the same level as the infrastructure level.

How to Run without infra

Rename .env.example file to .env inside your project root and fill the database information.

DB_CONNECTION = mysql
DB_HOST = 127.0.0.1
DB_PORT = 3306 (This is usually the default)
DB_DATABASE = {Name of the DB}
DB_USERNAME = {DB user}
DB_PASSWORD = {DB password}

Open the console and cd your project root directory Run composer install or php composer.phar install

Run php artisan key:generate

Run php artisan migrate

Run php artisan db:seed to run seeders

How to testing

  • Run vendor/bin/phpunit to run all tests.
  • If you want to take a look at the rideService put and post endpoints, you have them in the files: PostRideServiceControllerTest, PutRideServiceControllerTest

DDD STRUCTURE EXPLAINED

-In app is the part coupled to Laravel that we cannot take to core as controllers, formRequest, and DB models.

  • In core, the project is broken down into the three main layers: Application, Domain and Infrastructure.

-In the tests folder, we can see the three possible test suites:

-E2E: That they launch the request on a route, waiting for a response (As if you were using postman, you can see the response by debugging the variable $ response).

-Unit: Totally unitary test, with use of Mocks, of the Application services, in this c I have only made one to serve as an example.

-Integration: Checking the functions that interact with DB, to see what they return what we expect.

CORE FOLDER

DOMAIN: - Inside the Domain folder, you can see both the created value-objects used to define the domain, as the domain entities themselves. (Not much domain logic, since all endpoint functions are more of a CRUD).

APPLICATION: Within Application, we have the application layer that in this case will be in charge of receive from the controller the corresponding data or data, interact with the domain, and use the interface contracts, which will implement their corresponding repositories for persist/query.

INFRASTRUCTURE: Infrastructure has the implementation according to the contract / interface that defines the domain, on the repositories.

FINALLY THE DATA FLOW IS

  Controller → Application Service → Domain → Application Service → Repository →
  Application Service → Controller → Response.

As you can see, it follows the flow of Hexagonal Architecture.

You might also like...
Demo project for the API Platform / DDD Workshop

Workshop DDD x API Platform This is a demo project used for the DDD x API Platform Workshop by @chalasr & @mtarld from @coopTilleuls. Checkout git clo

Enraged Xenomorph - DDD/CQRS Symfony Application Boilerplate
Enraged Xenomorph - DDD/CQRS Symfony Application Boilerplate

Enraged Xenomorph - DDD/CQRS Symfony Application Boilerplate This project is very opinionated attempt to compile a bit of experience, few good practic

 🐘 🎯 Hexagonal Architecture, DDD & CQRS in PHP
🐘 🎯 Hexagonal Architecture, DDD & CQRS in PHP

🐘 🎯 Hexagonal Architecture, DDD & CQRS in PHP Example of a PHP application using Domain-Driven Design (DDD) and Command Query Responsibility Segrega

Dockerise Symfony Application (Symfony 6 + Clean Architecture+ DDD+ CQRS + Docker + Xdebug + PHPUnit + Doctrine ORM + JWT Auth + Static analysis)

Symfony Dockerise Symfony Application Install Docker Install Docker Compose Docker PHP & Nginx Create Symfony Application Debugging Install Xdebug Con

A Symfony project made with DDD, CQRS and Hexagonal Architecture

Symfony Blog DDD + CQRS + Hexagonal Architecture A Symfony blog project made with CQRS, Hexagonal Architecture and DDD Docker integration This project

Because every Wedding RSVP website needs to follow DDD, CQRS, Hexagonal Architecture, Event Sourcing, and be deployed on Lambda.
Because every Wedding RSVP website needs to follow DDD, CQRS, Hexagonal Architecture, Event Sourcing, and be deployed on Lambda.

Our Wedding Website Because every Wedding RSVP website needs to follow DDD, CQRS, Hexagonal Architecture, Event Sourcing, and be deployed on Lambda. ?

Clean Architecture, DDD and CQRS using Symfony 6

Task manager system using Clean Architecture, DDD and CQRS. Environment setup Install Docker Clone the project: git clone https://github.com/k0t9i/Tas

Ecotone Framework is Service Bus Implementation. It enables message driven architecture and DDD, CQRS, Event Sourcing PHP
Ecotone Framework is Service Bus Implementation. It enables message driven architecture and DDD, CQRS, Event Sourcing PHP

This is Read Only Repository To contribute make use of Ecotone-Dev repository. Ecotone is Service Bus Implementation, which enables message driven arc

Test with laravel framework

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Owner
pegons
pegons
YCOM Impersonate. Login as selected YCOM user 🧙‍♂️in frontend.

YCOM Impersonate Login as selected YCOM user in frontend. Features: Backend users with admin rights or YCOM[] rights, can be automatically logged in v

Friends Of REDAXO 17 Sep 12, 2022
This repository contains academic codes from experiments and labs I did during my academic years.

Table Of Content Semester 3 Business Communication Skills Computer Graphics Digital Electronics and Logic Design Fundamentals of Data Structures Human

Pratik Pingale 13 Nov 29, 2022
A Laravel artisan based package to create the AWS (SES + SNS) infrastructure to receive email event notifications with Http/Https endpoint.

Laravel SES Tracking Setup the AWS infrastructure to handle email events using SES/SNS and http/s endpoints with a single Laravel artisan command. Thi

null 11 Apr 26, 2022
Nuber is an open source container management platform it provides a front end to manage your own cloud infrastructure, using Linux Containers virtualization technology

Nuber is an open source container management platform it provides a front end to manage your own cloud infrastructure, using Linux Containers virtualization technology

null 33 Dec 14, 2022
This script allows to bypass Oracle Cloud Infrastructure 'Out of host capacity' error immediately when additional OCI capacity will appear in your Home Region / Availability domain.

Resolving Oracle Cloud "Out of Capacity" issue and getting free VPS with 4 ARM cores / 24GB of memory Very neat and useful configuration was recently

Alexander Hitrov 323 Jan 6, 2023
Pika is a nosql compatible with redis, it is developed by Qihoo's DBA and infrastructure team

Introduction中文 Pika is a persistent huge storage service , compatible with the vast majority of redis interfaces (details), including string, hash, li

OpenAtomFoundation 4.9k Jan 6, 2023
Orkestra is a library of infrastructure and architecture helpers for creating CQRS applications

Orkestra Orkestra is an opinionated framework with a plethora of recommendations on architectural design that we use internally at Morebec to develop

Morébec 2 Aug 18, 2021
Mailing Microservice - My solution for Moroccan PHPers's February 2022 Challenge

Mailing Microservice Solution for Moroccan PHPers's February 2022 Challenge by Rabyâ Raghib ([email protected]). It mainly consists of: a php app th

Rabyâ Raghib 1 Aug 11, 2022
A PHP microservice for helping know who's who

Identity service Identity is a microservice and API (Application Programming Interface) used for handling everything to do with who's who. For now the

The Big Give 1 Dec 22, 2022
POC d'un projet Clean Architecture + DDD

Proof Of Concept - Clean Architecture & DDD Installation Dans un premier temps, cloner le repository : git clone https://github.com/TBoileau/rse cd rs

Thomas Boileau 11 Sep 3, 2022