Download the PHP package jmsr/ddd-laravel without Composer
On this page you can find all versions of the php package jmsr/ddd-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jmsr/ddd-laravel
More information about jmsr/ddd-laravel
Files in jmsr/ddd-laravel
Package ddd-laravel
Short Description CRUD assistant to create DDD classes and dependency injections
License mit
Informations about the package ddd-laravel
DDD Laravel
CRUD wizard for creating DDD classes and dependency injections.
This library is designed to add CRUD commands of elements with DDD structure in your Laravel project.
These commands are used by "php artisan" (you can get a list of them using php artisan
) and are as follows:
- make-ddd
- make-ddd:dump-dependencies
- make-ddd:end-point
- make-ddd:injection
- make-ddd:interface
- make-ddd:thing
- make-ddd:update-injections
Installation
You can install it using composer with next command, or simply adding jmsr/ddd-laravel
to your composer.json file.
Commands
Dump dependencies
This command automatically creates the necessary relationships, in Laravel, between constructors and dependencies that are reflected in the src/config/injections.yml
file.
Example of relations for the src/config/injections.yml
file:
Create an Endpoint
With this command you can automatically create the endpoints of your application, based on the usecases created. You just need to follow the simple guide that will ask you questions after executing the command.
You can create an endpoint passing UseCase route by command line parameter:
The default values to create the endpoint are the following (you can change them during the executting of assistance):
- $route_name (null): You can define a direct name for the route, just as Laravel routes allow.
- $method (post): Allowed method to call the endpoint, you can set multiple methods, separated by commas. (example: post, get, put).
- $url (null): Path to call the endpoint, if the value is null it will be generated automatically based on the name of the UseCase.
- $function (execute): Endpoint function that will be used by default when calling the endpoint (this default value is "execute").
- $file (web): For which Laravel routes file the endpoint will be created, the two options are "web" or "api".
Create an Injection
Just run this command and the wizard will guide you to create all the injections you need on any of the DDD elements that you have defined in the src/Application
, src/Domain
and src/Infrastructure
directories of your Laravel project .
It is recommended that all the existing elements in your
src
directories have been generated with the make-ddd:thing command of this plugin.
Create an Interface
Just create an interface in the directory space src/Application/Domain
Create Thing
With this command we can create several types of elements given in DDD architecture, which are usecase
,service
, repository
andmodel
.
In the case of creating a service or a repository, an associated interface will be created automatically in the src / Application
directory.
Update Injections
Just run this command and the plugin will read all the classes in your src
directory for constructor dependencies and insert the new dependencies into your project's src/config/injection.yml
file, in the correct format.