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

v0.0.6 2026-01-29 11:33 UTC

This package is auto-updated.

Last update: 2026-01-29 11:34:04 UTC


README

CI Coverage Latest Version Total Downloads License

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-cache
  • php artisan ddd:event-listeners-cache
  • php 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.

📄 License

MIT