Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
lennyrouanet committed Apr 16, 2021
1 parent af9f1d7 commit 324e5b9
Show file tree
Hide file tree
Showing 28 changed files with 191 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Dependances
/vendor/*
119 changes: 117 additions & 2 deletions README.md
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 added app/.gitkeep
Empty file.
Empty file added app/Domain/.gitkeep
Empty file.
8 changes: 8 additions & 0 deletions app/Domain/Action.php
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 added app/Domain/Action/.gitkeep
Empty file.
8 changes: 8 additions & 0 deletions app/Domain/Entity.php
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 added app/Domain/Entity/.gitkeep
Empty file.
8 changes: 8 additions & 0 deletions app/Domain/Exception.php
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 added app/Domain/Exception/.gitkeep
Empty file.
8 changes: 8 additions & 0 deletions app/Domain/Manager.php
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 added app/Domain/Manager/.gitkeep
Empty file.
8 changes: 8 additions & 0 deletions app/Domain/Port.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
declare(strict_types=1);

namespace App\Domain;

interface Port
{
}
8 changes: 8 additions & 0 deletions app/Domain/ValueObject.php
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 added app/Domain/ValueObject/.gitkeep
Empty file.
8 changes: 8 additions & 0 deletions app/Infrastructure/Adapter.php
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.
8 changes: 8 additions & 0 deletions app/Infrastructure/Controller.php
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.
8 changes: 8 additions & 0 deletions app/Infrastructure/Middleware.php
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 added app/Presentation/.gitkeep
Empty file.
Empty file.
Empty file added config/.gitkeep
Empty file.
Empty file added config/dependencies.php
Empty file.
Empty file added config/routes.php
Empty file.
Empty file added public/.gitkeep
Empty file.
Empty file added public/index.php
Empty file.

0 comments on commit 324e5b9

Please sign in to comment.