Description
Description
I try to structure my project according to Domain-Driven Design principles. Specifically, I want my models and controllers to be placed in the appropriate domain-specific directories more easily. Below is an example of my draft.yml
configuration:
models:
NameOfDomain\Models\NameOfModel:
name: string
controllers:
# ...
In my config/blueprint.php
, I have set the following:
'namespace' => 'App\\Domains',
'models_namespace' => '',
'controllers_namespace' => '',
This setup works as expected—models and controllers are correctly placed in the appropriate directories under app/Domains/. However, configuring the paths and namespaces manually in the draft.yml file feels cumbersome.
Expected Behavior
I would like a simpler way to configure Blueprint so that files are automatically generated under the appropriate domain-specific directories (e.g., app/Domains/NameOfDomain/Models/NameOfModel.php) without having to explicitly define the full namespace path in draft.yml.
Current Behavior
Currently, I have to explicitly define the full namespace path in the draft.yml file for each model or controller, which can be tedious for larger projects with multiple domains.
Steps to Reproduce
- Configure Blueprint with the above
config/blueprint.php
settings and adraft.yml
file as shown. - Run php artisan
blueprint:build
. - Check the generated files in
app/Domains
.
Possible Solution
Could there be an enhancement to Blueprint to support a simpler configuration for Domain-Driven Design projects? For example:
Allow defining a base domain or namespace in config.php or draft.yml - or one draft.yml file per domain?
Automatically infer the directory structure based on the domain and type of resource (e.g., models or controllers).
This would reduce the need for repetitive configuration in draft.yml and make it easier to generate files in a clean Domain-Driven Design structure.
Thank you for providing this tool—it’s been very helpful so far!