fixik / ddd-generator
DDD generator for Laravel
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/fixik/ddd-generator
Requires
- php: ^8.1
- illuminate/console: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0|^10.0
- phpunit/phpunit: ^10.0|^11.0|^12.0
README
A Laravel package for generating Domain-Driven Design (DDD) modules with CQRS, modular architecture, and HTTP API presets.
Opinionated, test-driven, production-ready scaffolding for large Laravel apps.
✨ Features
- Modular DDD structure (
App/Modules/*) - Clean separation:
- Domain / Application / Infrastructure
- CQRS (Commands / Queries / Handlers)
- HTTP API generation (Controllers, Requests, Resources, Routes)
- Idempotent generators (safe to re-run)
- Preset-based generation (
domain,http-crud,http-api) + optional--style=cqrs - Custom base namespace and path
- Fully covered by tests
🚀 Quick Start
Install
composer require fixik/ddd-generator --dev
Generate API HTTP module
php artisan ddd:make http-api Order --entity=Order
This will generate:
- Domain entity & repository
- CQRS commands / queries & handlers
- HTTP controller, request, resource
- Module routes
- Module ServiceProvider
📦 Presets
| Preset | Description |
|---|---|
domain |
Domain only (Entities, Events, Repositories) |
domain + --style=cqrs |
Domain + CQRS (Commands, Queries, Handlers) |
http-crud |
Domain + HTTP CRUD (Controllers, Requests, Routes) |
http-api |
Domain + HTTP API (Controllers, Requests, Routes) |
http-api + --style=cqrs |
Domain + CQRS + HTTP API |
📚 Documentation
👉 Full documentation:
https://olegmarko.github.io/ddd-generator/
Includes:
- Architecture overview
- Presets explained
- CQRS flow
- Configuration
- Extending generators
🧠 Philosophy
This package enforces explicit architecture:
- No hidden magic
- No guessing entities
- No global routes
- No infrastructure leaks into domain
- Designed for long-living Laravel applications.
⚡ Performance & Caching
The generator provides optional cache commands for large, modular applications:
php artisan ddd:modules-cachephp artisan ddd:event-listeners-cachephp artisan ddd:cache-clear
These commands are intended ONLY for production environments.
They should NOT be used in:
- local development
- automated tests
- CI pipelines
They work similarly to Laravel's route:cache and event:cache
and significantly reduce bootstrapping overhead in large projects.