Artisan command package to handle your Domain Driven Design project that suitable with Laravel base structures, made for comer of Domain Driven Design and advanced.
Install Diamond Console with composer
composer require koalafacade/diamond-console
then after Diamond Console installed run command below to set up your project. The command below will generate namespace in composer and base directory structures.
php artisan diamond:install
Command for generate an action inside your domain directory.
Arguments
Name | Description |
---|---|
Name | Action class name |
Domain | Domain Name |
Options
Name | Description |
---|---|
--force | Force create the action |
Command for generate an enum to your domain directory.
Arguments
Name | Description |
---|---|
Name | Enum class name |
Domain | Domain Name |
Options
Name | Description |
---|---|
--force | Force create the enum |
Command for generate a Data Transfer Object with plain PHP to your domain directory.
Arguments
Name | Description |
---|---|
Name | Data Transfer Object class name |
Domain | Domain Name |
Options
Name | Description |
---|---|
--force | Force create the Data Transfer Object |
Command for generate a migration file
Arguments
Name | Description |
---|---|
Name | Table Name |
Options
Name | Description |
---|---|
--table | to generate a migration with purpose edit table |
--create | to generate a migration with purpose to create a table |
Command for generate a model inside Shared in Domain directory, all model will store shared folder since another domain probably consume the model at the same time.
Arguments
Name | Description |
---|---|
Name | Model name |
Domain | Domain Name |
Options
Name | Description |
---|---|
-m or --migration | Create migration file when model created |
-f or --factory | Create factory class when model created this option will generate two files, Factory contract and Factory concrete |
--force | Force create the enum |
Command for generate a factory class, this command would generate two files :
- Factory concrete at Infrastructure/{DomainName}/Database/Factories
- Factory Contract at Domain/Shared/Contracts/Database/Factories
The bottom of reason why we did this, cause Factories is an Infrastructure component then Domain can't consume any stuff inside infrastructure, so you can do Dependency Injection at Service Provider for resolve this one.
Arguments
Name | Description |
---|---|
Name | Factory Name |
Domain | Domain Name |
Options
Name | Description |
---|---|
--force | Force create the factory |
Command for generate a Mail class. this command will generate Mail class into Infrastructure side because this class purpose is store to external.
Arguments
Name | Description |
---|---|
Name | Mail name class |
Domain | Domain Name |
Options
Name | Description |
---|---|
--force | Force create the Mail class |
Thanks for consideration to contribute to Diamond Console of Domain Driven Design you can go through to Contribute Area