toniel / laravel-ddd
Domain-Driven Design (DDD) scaffolding for Laravel with support for Laravel Actions and Spatie Data
Installs: 57
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/toniel/laravel-ddd
Requires
- php: ^8.1
- illuminate/console: ^9.0|^10.0|^11.0|^12.0
- illuminate/support: ^9.0|^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^7.0|^8.0|^9.0
- phpunit/phpunit: ^9.5|^10.0
Suggests
- lorisleiva/laravel-actions: Required for using ddd:action command (^2.0)
- spatie/laravel-data: Required for using ddd:data command (^4.0)
README
A powerful Domain-Driven Design (DDD) scaffolding package for Laravel with support for Laravel Actions and Spatie Data.
Note: This package is currently in early development (v0.x). The API may change before the stable 1.0 release. Feedback and contributions are welcome!
Features
- ✅ 15 comprehensive commands for complete DDD workflow
- ✅ Auto-generate domain structure with a single command
- ✅ Auto-register ServiceProvider (Laravel 9-12)
- ✅ Auto-load routes, migrations, and views
- ✅ 3 controller types - Resource, API, Invokable
- ✅ Laravel Actions integration (as Job, Controller, or standalone)
- ✅ Spatie Laravel Data integration with validation
- ✅ Inertia.js page generation (Vue & React with TypeScript)
- ✅ Blade views with domain namespace
- ✅ API Resources (single & collection)
- ✅ Form Requests with validation
- ✅ Jobs (queued & synchronous)
- ✅ Mail classes with markdown support
- ✅ Separate folders for Blade (Views) and Inertia (Pages)
- ✅ PSR-4 autoloading
- ✅ Fully tested with PHPUnit
Requirements
- PHP ^8.1
- Laravel ^9.0 | ^10.0 | ^11.0 | ^12.0
Installation
composer require toniel/laravel-ddd php artisan ddd:install composer dump-autoload
Quick Start
# Create a complete domain
php artisan ddd:domain Product
php artisan ddd:model Product Product -mfs
php artisan ddd:controller Product ProductController --api
php artisan ddd:page Product ProductIndex
php artisan migrate
Documentation
For complete documentation, please visit GitHub Repository.
Available Commands
| Command | Description |
|---|---|
ddd:install |
Setup DDD structure |
ddd:domain {name} |
Create new domain |
ddd:controller {domain} {name} |
Create controller (Resource/API/Invokable) |
ddd:model {domain} {name} |
Create model with optional migration/factory/seeder |
ddd:migration {domain} {name} |
Create migration |
ddd:factory {domain} {name} |
Create factory |
ddd:seeder {domain} {name} |
Create seeder |
ddd:action {domain} {name} |
Create Laravel Action |
ddd:data {domain} {name} |
Create Spatie Data object |
ddd:view {domain} {name} |
Create Blade view |
ddd:page {domain} {name} |
Create Inertia page (Vue/React) |
ddd:resource {domain} {name} |
Create API resource |
ddd:request {domain} {name} |
Create form request |
ddd:job {domain} {name} |
Create job |
ddd:mail {domain} {name} |
Create mail class |
Testing
composer test
Roadmap to 1.0
- Community feedback and bug fixes
- Additional generators (Events, Listeners, Policies, etc.)
- More comprehensive test coverage
- Documentation improvements
- Real-world usage validation
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Security
If you discover any security related issues, please email l.toni2007@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.