Download the PHP package oleglfed/laravel-ddd without Composer
On this page you can find all versions of the php package oleglfed/laravel-ddd. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download oleglfed/laravel-ddd
More information about oleglfed/laravel-ddd
Files in oleglfed/laravel-ddd
Package laravel-ddd
Short Description Generates domains for laravel Domain Driven Development
License MIT
Homepage https://github.com/oleglfed/laravel-ddd
Informations about the package laravel-ddd
Laravel DDD
Domain Driven Development domains generator.
This package is made to generate Domains, based on DB table.
Package get all table fields and creates domain. With Domain creates repository, service and Infrastructure. Also the Package automatically binds generated classes to your app, so you can easily use DI or make Service by contract $service = app(UserServiceInterface::class);
php artisan make:domain User --table=users
Installation:
Require this package with composer using the following command:
Go to your config/app.php
and add the service provider:
\oleglfed\LaravelDDD\LaravelDddServiceProvider::class
Usage
This package creates app/Domain
and app/Infrastructure
directories. So at first package should be able to create these two directories. Afterwards, you can revoke writable access from app
directory.
This package requires writable permissions to config/domains directory.
Before use, create config/domains
directory with writable permissions or allow the package to write into config
directory. It is necessary for writing domains binding. Afterwards, these domains will be bound to your app by LaravelDddServiceProvider
To generate domain, use the make:domain
artisan command. This command will create in ths Domains and Infrastructures directories inside app/ folder domain classes.
E.g. for User will be created classes
UserEloquent
UserRepository
EloquentUserRepository
UserService
And contracts for this classes
Available command options:
Option | Description |
---|---|
table |
Based on Table will be created Eloquent, getters and setters |
directory |
By default directory name takes from domain name. To override it --directory might be set |
domain-path |
By default domain directory is app/Domains. To override it --domain-path might be set |
infrastructure-path |
By default infrastructure directory is app/Infrastructures. To override it --infrastructure-path might be set |
Advanced usage
This package contains a few useful methods to work with services and repositories.
If your routes use resource
you can explicitly bind Domains
Open Providers\RouteServiceProvider
and add:
Then you are able to use:
License
The Laravel DDD Generator is free software licensed under the MIT license.