andreyizmaylov/base-domain-structure

Base domain structure for Laravel applications

Maintainers

Package info

github.com/andrewizmaylov/ddd-structure

pkg:composer/andreyizmaylov/base-domain-structure

Statistics

Installs: 13

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

1.2.4 2026-02-23 14:27 UTC

This package is auto-updated.

Last update: 2026-03-23 14:39:03 UTC


README

A template scaffold that implements Domain-Driven Design principles for Laravel, providing a clean, opinionated structure so you can focus on what matters: your business domain.

🚀 Installation

composer require andreyizmaylov/base-domain-structure

🎯 Publish the configuration: *

php artisan vendor:publish --tag=base-domain-structure-config

🔄 Directory Structure Visualization

Here's a more detailed tree view of your configurable structure:

src/Balance/
├── ApplicationLayer/
│   └── UseCases/
│       └── UpdateBalanceUseCase.php
├── DomainLayer/
│   ├── Entities/
│   ├── Repository/
│   │   ├── AccountRepositoryInterface.php
│   │   └── BalanceTransactionRepositoryInterface.php
│   ├── Services/
│   │   ├── BalanceUpdateService.php
│   │   └── CreateTransactionsService.php
│   ├── Storage/
│   │   ├── AccountStorageInterface.php
│   │   └── BalanceTransactionStorageInterface.php
│   └── ValueObjects/
├── InfrastructureLayer/
│   ├── Repository/
│   │   ├── AccountRepository.php
│   │   └── BalanceTransactionRepository.php
│   └── Storage/
│       ├── AccountStorage.php
│       └── BalanceTransactionStorage.php
└── PresentationLayer/
    └── HTTP/V1/
        ├── Controllers/
        │   └── UpdateBalanceController.php
        ├── Requests/
        │   └── UpdateBalanceRequest.php
        ├── Responders/
        │   └── BalanceTransactionResponder.php
        └── routes.php

After publishing, you can modify default domain structure:

    'structure' => [
        'ApplicationLayer',
        'DomainLayer' => [
            'Entities',
            'ValueObjects',
            'Repository',
            'Storage'
        ],
        'InfrastructureLayer' => [
            'Repository',
            'Storage',
        ],
        'PresentationLayer' => [
            'HTTP' => [
                'V1' => [
                    'Controllers',
                    'Requests',
                    'Responders',
                    'routes.php'
                ]
            ]
        ],
    ],

📁 Customize Your Source Folder

By default, domains are created in app/src/. You can change this via your .env file:

BASE_DOMAIN_SRC_DIR=Domain

Commands

Create Context structured folder

php artisan make:context Balance

Create UseCase structured folder

php artisan make:use-case UpdateBalance Balance

🙏 Acknowledgements

Mehul Koradiya - For his foundational work on laravel-enterprise-structure, which inspired this package ❤️.

📄 License

The MIT License (MIT). See LICENSE file for details.