/PHP-Domain-Driven-Design-DDD

PHP-Domain-Driven Design-DDD

Primary LanguagePHP

PHP following Domain-Driven Design (DDD) principles

app/
    ├── config/
    │   ├── database.php
    ├── Domain/
    │   ├── Todo/
    │   │   ├── TodoItem.php
    │   │   ├── TodoRepository.php
    │   │   ├── TodoService.php
    │   ├── User/
    │   │   ├── User.php
    │   │   ├── UserRepository.php
    │   │   ├── UserService.php
    ├── Infrastructure/
    │   ├── Persistence/
    │   │   ├── Todo/
    │   │   │   ├── MySQLTodoRepository.php
    │   │   ├── User/
    │   │   │   ├── MySQLUserRepository.php
    ├── Presentation/
    │   ├── Controllers/
    │   │   ├── TodoController.php
    │   │   ├── UserController.php
    │   ├── Views/
    │   │   ├── todo/
    │   │   │   ├── index.php
    │   │   │   ├── create.php
    │   │   ├── user/
    │   │   │   ├── profile.php
    │   │   ├── layouts/
    │   │   │   ├── app.php
    ├── public/
    │   ├── css/
    │   ├── js/
    ├── routes/
    │   ├── web.php
    ├── templates/
    │   ├── base.html
    │   ├── todo/
    │   │   ├── index.html
    │   │   ├── create.html
    │   ├── user/
    │   │   ├── profile.html

Here's a breakdown of the main directories and their purposes:

config: Configuration files for your application, including database configuration (database.php).

Domain: Organize your domain logic here. It includes Todo and User domains with entities, repositories, and services.

Infrastructure: This is where infrastructure-related code resides. It contains Persistence with repository implementations using MySQL (e.g., MySQLTodoRepository, MySQLUserRepository).

Presentation: Handle the user interface and HTTP interactions here. Controllers manage HTTP requests and communicate with domain services, while Views contain PHP templates for rendering the user interface.

public: Publicly accessible assets like CSS and JavaScript files.

routes: Define your application routes in web.php. This is where you handle routing for HTTP requests.

templates: This directory contains base templates (base.html) and templates for different views (e.g., todo, user) for rendering the user interface.