-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af9f1d7
commit 324e5b9
Showing
28 changed files
with
191 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Dependances | ||
/vendor/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,117 @@ | ||
# DDD-skeleton | ||
Domain-Driven Design skeleton | ||
# DDD skeleton | ||
|
||
## Folder tree | ||
|
||
``` | ||
. | ||
├── app | ||
│ ├── Domain | ||
│ │ ├── Action | ||
│ │ ├── Entity | ||
│ │ ├── Exception | ||
│ │ ├── Manager | ||
│ │ ├── Port | ||
│ │ └── ValueObject | ||
│ ├── Infrastructure | ||
│ │ ├── Adapter | ||
│ │ ├── Controller | ||
│ │ └── Middleware | ||
│ └── Presentation | ||
│ └── Template | ||
├── config | ||
└── public | ||
``` | ||
|
||
|
||
## Usage by folter | ||
|
||
### app | ||
|
||
In this folder, we will find the application itself. | ||
|
||
|
||
#### Domain | ||
|
||
Here is the domain you manage. | ||
|
||
|
||
##### Action | ||
|
||
Actions are accessible from outside your domain (your controllers). Each action must represent an action of the domain. | ||
|
||
Ex. : register a new user, confirm the order, etc. | ||
|
||
|
||
##### Entity | ||
|
||
Entities are the representation of objects inherent to the domain. | ||
|
||
Ex. : User, Product, etc. | ||
|
||
|
||
##### Exception | ||
|
||
Exceptions are the representation of errors. | ||
|
||
|
||
##### Manager | ||
|
||
Managers are in charge of carrying out each business action, for this they will have to use the adapters. | ||
|
||
|
||
##### Port | ||
|
||
Ports are the interfaces to which the adapters must be supported. | ||
|
||
|
||
##### ValueObject | ||
|
||
Value Objects are representations of data typed according to your domain. | ||
|
||
Ex. : E-mail, Id, Price, etc. | ||
|
||
|
||
#### Infrastructure | ||
|
||
Here is what is peripheral to the domain you manage, communication with your dependencies (database, client interface, client API, etc.). | ||
|
||
|
||
##### Adapter | ||
|
||
Adapters are the outgoing interfaces of your application. | ||
|
||
Ex. : database, APIs consumed, etc. | ||
|
||
|
||
##### Controller | ||
|
||
Controllers are the inbound interfaces of your application. | ||
|
||
Ex. : browser, API exposed, CLI, etc. | ||
|
||
|
||
##### Middleware | ||
|
||
Middlewares will take care of inbound and outbound access management. | ||
|
||
Ex. : token verification, error catching, etc. | ||
|
||
|
||
#### Presentation | ||
|
||
In this folder, we find all the resources and processing inherent to rendering views (html, xml, etc.) | ||
|
||
|
||
##### Template | ||
|
||
Here are the templates used to render the views of your application. | ||
|
||
|
||
### config | ||
|
||
In this folder, we will find the configuration of the application: its parameters, its routes and the call to its dependencies. | ||
|
||
|
||
### public | ||
|
||
In this folder, we will find the index of the app and the front resources accessible from the client. It is also this folder which will be the root of your web server. |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace App\Domain; | ||
|
||
abstract class Action | ||
{ | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace App\Domain; | ||
|
||
abstract class Entity | ||
{ | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace App\Domain; | ||
|
||
abstract class Exception extends \Exception | ||
{ | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace App\Domain; | ||
|
||
abstract class Manager | ||
{ | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace App\Domain; | ||
|
||
interface Port | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace App\Domain; | ||
|
||
abstract class ValueObject | ||
{ | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace App\Infrastructure; | ||
|
||
abstract class Adapter | ||
{ | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace App\Infrastructure; | ||
|
||
abstract class Controller | ||
{ | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace App\Infrastructure; | ||
|
||
abstract class Middleware | ||
{ | ||
} |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.