signifly/laravel-domain-commands
Artisan commands for scaffolding domain-driven design in Laravel. Quickly generate domains, actions, and supporting classes with a consistent structure, so business logic stays organized and your codebase remains easy to navigate and extend.
This package is a scaffolding helper: it generates the boilerplate classes for a domain-oriented (DDD-ish) Laravel codebase so you don't hand-create folders and namespaces. Treat it as a code generator, not a runtime dependency.
composer.json constraints against your Laravel/PHP version. If you're on a newer Laravel major, expect to fork or pin.composer require --dev signifly/laravel-domain-commands
php artisan list | grep -i domain
php artisan help <command-name>
php artisan vendor:publish --provider="Signifly\DomainCommands\...ServiceProvider"
(Use php artisan vendor:publish --list if the provider/tag isn't obvious.)Billing — generate one action/class, open the generated file, and verify the namespace and path match your app's composer.json autoload. Only then generate the rest of the domain.The first thing to read is the package's src/ command classes and stubs, not just the README. With an archived 22-star package, the source is the documentation.
Decide your domain layout before generating anything. The package just writes files to configured paths; if your team hasn't agreed on app/Domain/{Context}/{Layer} vs src/{Context}/..., you'll generate inconsistent code. Configure paths once, commit that config, and treat it as the contract.
Generate per bounded context, not per Laravel artifact. The workflow that pays off day-to-day:
Sales) and scaffold its actions, DTOs, events, and exceptions in one pass.Wrap generation in a repeatable script. Because the package is archived and its command signatures are fixed, hide it behind a Makefile or Composer script:
"scripts": {
"make:action": "php artisan <domain-command>"
}
This makes it trivial to swap the generator later without rewriting team habits.
Integrate at the edges. Controllers, form requests, jobs, and console commands should call into generated domain classes; they shouldn't contain domain logic themselves. Bind domain services/repositories in a dedicated service provider. If you're pragmatic DDD, it's fine for Eloquent models to live inside the domain folder — just be consistent.
Enforce the boundaries you're scaffolding. Generation alone doesn't create architecture. Add Pest/PHPUnit architecture tests (e.g. Pest's arch()) that assert domain namespaces don't depend on HTTP or facade-heavy code. This is the single highest-value complement to a scaffolder.
Review generated diffs like handwritten code. Don't regenerate in CI. Generate locally, edit the output (add declare(strict_types=1), final, return types), and commit. The generator only gets you 60% there.
php artisan list and php artisan help <command>. If help errors, the command may have been renamed between the README and the release.php artisan config:clear. In production-like environments a cached config will silently use old paths.App\ won't resolve until you update composer.json and run composer dump-autoload. If a generated class "doesn't exist," this is usually why.Class, List, Trait), and avoid names that collide with Laravel classes.-v verbosity and inspect the target directory before rerunning.mkdir may surface as a cryptic or silent failure.final, or your preferred constructor style. Publish/override stubs if supported; otherwise, fork the package and edit the stub files — it's a small codebase, so forking is realistic.-v, inspect the exact path written, check composer dump-autoload, then check config cache. That sequence resolves most "it generated nothing / class not found" reports.How can I help you explore Laravel packages today?