Building Domain Driven Applications in Laravel (the easy way)
So, you read the Laravel Beyond CRUD series and thought this is the way. Now what? Start building a domain-driven application in Laravel from scratch is a real pain in the ass, I know from experience.
So what do you do? The easy answer: install my Laravel Domain Library (LDL) and let it do its magic.
I build this package because I’m a lazy coder. I don’t like to waste time on menial tasks like building, again and again, hundreds of small classes when I can spend the same amount of time creating software that does it for me ;)
LDL allows you to implement the same domain driven applications that Brent at Spatie develops.
How does it work?
LDL is a collection of Artisan commands that lets you do two main tasks:
- rewire a brand new Laravel application into a domain driven one;
- make all the classes needed for such an application.
Let’s start with a clean Laravel installation. From your favorite shell:
laravel new project
Then install the library:
cd project
composer require filippo-toso/laravel-domain-library
composer require spatie/data-transfer-object spatie/laravel-model-states spatie/laravel-query-builder spatie/laravel-view-models
The additional Spatie’s packages are required for data transfer objects, model states…