PHPackages                             rabnawazak1/laravel-ddd-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. rabnawazak1/laravel-ddd-generator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rabnawazak1/laravel-ddd-generator
=================================

Artisan command to scaffold DDD domain modules in Laravel

036PHP

Since Apr 27Pushed 1mo agoCompare

[ Source](https://github.com/rabnawazak1/laravel-ddd-generator)[ Packagist](https://packagist.org/packages/rabnawazak1/laravel-ddd-generator)[ RSS](/packages/rabnawazak1-laravel-ddd-generator/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel DDD Generator
=====================

[](#laravel-ddd-generator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0c07540c051b5b1405530dc122aeb0b22d45d1ba1ad570ca2b908cf07bd31042/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7261626e6177617a616b312f6c61726176656c2d6464642d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rabnawazak1/laravel-ddd-generator)[![Total Downloads](https://camo.githubusercontent.com/7b9cf2854289d0ee0bdc04699135f88baf4893b0ce4bff979b713ea0cdba9173/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7261626e6177617a616b312f6c61726176656c2d6464642d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rabnawazak1/laravel-ddd-generator)[![License](https://camo.githubusercontent.com/f32796d6c3bd4d6a1db48c9e28f1f91e73c548b26dbca63232f07ee350f89551/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7261626e6177617a616b312f6c61726176656c2d6464642d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![PHP Version](https://camo.githubusercontent.com/a2a24bff0552fcc3e7bbbcdafefe53c5c9bf1e7522a6a0599fd8f63ebcb9858d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7261626e6177617a616b312f6c61726176656c2d6464642d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](composer.json)

A Laravel Artisan command to scaffold **Domain-Driven Design (DDD)** module structure instantly — complete with Actions, Controller, Requests, Service, Repository, Model, and DTO stubs.

---

Why DDD?
--------

[](#why-ddd)

Domain-Driven Design keeps large Laravel applications maintainable by grouping all files related to a domain feature together, rather than scattering them across `app/Http/Controllers`, `app/Models`, etc. This package gives you that structure with a single command.

---

Generated Structure
-------------------

[](#generated-structure)

Running `php artisan make:domain Hospital Patient` produces:

```
app/
└── Domains/
    └── Hospital/
        └── Patient/
            ├── Actions/
            │   ├── Create.php
            │   ├── Update.php
            │   ├── Delete.php
            │   ├── ChangeStatus.php
            │   └── Search.php
            ├── Controllers/
            │   └── PatientController.php
            ├── Requests/
            │   ├── StorePatientRequest.php
            │   ├── UpdatePatientRequest.php
            │   └── ChangePatientStatusRequest.php
            ├── Services/
            │   └── PatientService.php
            ├── Repositories/
            │   └── PatientRepository.php
            ├── Models/
            │   └── Patient.php
            └── DTO/
                └── PatientData.php

```

Every file is generated with a namespace-correct stub and `TODO` markers to guide your implementation.

---

Requirements
------------

[](#requirements)

DependencyVersionPHP^8.5Laravel10.x / 11.x / 12.x / 13.x---

Installation
------------

[](#installation)

Install via Composer:

```
composer require rabnawazak1/laravel-ddd-generator --dev
```

> The `--dev` flag is recommended since this is a development scaffolding tool. The package is auto-discovered by Laravel — no manual provider registration needed.

---

Usage
-----

[](#usage)

```
php artisan make:domain {Domain} {Module}
```

### Examples

[](#examples)

```
# Hospital Management System
php artisan make:domain Hospital Patient
php artisan make:domain Hospital Doctor
php artisan make:domain Hospital Appointment

# E-commerce
php artisan make:domain Shop Product
php artisan make:domain Shop Order
php artisan make:domain Shop Invoice

# Multi-word inputs use StudlyCase automatically
php artisan make:domain HumanResources LeaveRequest
```

**Arguments:**

ArgumentDescriptionExample`domain`The top-level domain group`Hospital`, `Shop`, `Auth``module`The specific module inside the domain`Patient`, `Product`, `User`Both arguments are automatically converted to `StudlyCase`, so `hospital` and `Hospital` produce the same result.

---

What Gets Generated
-------------------

[](#what-gets-generated)

FilePurpose`Actions/Create.php`Single-responsibility action for creating a record`Actions/Update.php`Single-responsibility action for updating a record`Actions/Delete.php`Single-responsibility action for deleting a record`Actions/ChangeStatus.php`Action for toggling/changing status`Actions/Search.php`Action for search/filter logic`Controllers/{Module}Controller.php`HTTP controller extending Laravel's base Controller`Requests/Store{Module}Request.php`Form request for store validation`Requests/Update{Module}Request.php`Form request for update validation`Requests/Change{Module}StatusRequest.php`Form request for status change`Services/{Module}Service.php`Service layer for orchestrating actions`Repositories/{Module}Repository.php`Repository for database query logic`Models/{Module}.php`Eloquent model`DTO/{Module}Data.php`Data Transfer Object for passing data between layersAll files are created only if they **do not already exist**, so re-running the command is safe.

---

Suggested Architecture
----------------------

[](#suggested-architecture)

Once generated, a typical request flow looks like:

```
Request → Controller → Service → Action → Repository → Model
                                     ↑
                                    DTO (carries validated data between layers)

```

---

Contributing
------------

[](#contributing)

Contributions are welcome! Please follow these steps:

1. Fork the repository
2. Create a feature branch: `git checkout -b feature/my-feature`
3. Commit your changes: `git commit -m 'Add some feature'`
4. Push to the branch: `git push origin feature/my-feature`
5. Open a Pull Request

Please make sure your code follows PSR-12 coding standards.

---

Changelog
---------

[](#changelog)

### v1.0.0

[](#v100)

- Initial release
- `make:domain` command with full DDD scaffold
- Support for Laravel 10, 11, 12, 13

---

License
-------

[](#license)

The MIT License (MIT). See the [LICENSE](LICENSE) file for details.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance60

Regular maintenance activity

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5cbb0936ceb96cf570ac951620ce3ba4735eaefd26d39a2c8c84e72c31809796?d=identicon)[rabnawazak1](/maintainers/rabnawazak1)

---

Top Contributors

[![rabnawazak1](https://avatars.githubusercontent.com/u/230026422?v=4)](https://github.com/rabnawazak1 "rabnawazak1 (1 commits)")

### Embed Badge

![Health badge](/badges/rabnawazak1-laravel-ddd-generator/health.svg)

```
[![Health](https://phpackages.com/badges/rabnawazak1-laravel-ddd-generator/health.svg)](https://phpackages.com/packages/rabnawazak1-laravel-ddd-generator)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
