A domain is basically a way of grouping the logic of some parts so that you can work on that small parts without having to deal with all classes in your app.
It's sound heavy but it's actually a pretty lightweight practice. We talk about it in our book: laravel-beyond-crud.com
The "stick close to the default structure" mantra is the result of people who tried to go too far by putting stuff outside of the app directory, requiring service providers, splitting up resources/config directories.
When refactoring to domains, you're only changing a namespace.
Laravel doesn't care where classes are located.
You can refactor to a domain oriented approach if needed, simply by moving namespace around (you can do that very quickly with an IDE like PhpStorm).
Here's another example taken from the flareapp.io codebase.
By splitting our app up in domains, we can just focus on projects, our team functionality when we need to make changes.
Another example, for another big Laravel app: @OhDearApp
Oh Dear performs several types of checks, the all require a lot of logic. Those checks all live in the Checks domain under their own namespace.
This makes it easy for me to work on a single type of check.
When starting out with a new app, we usually don't create domains, we only do that when we feel it's needed.
Refactoring to domains only takes a couple of minutes, and it's easy to change domains, or revert back.
Make up your own mind if you find this practice useful.
Bonus thought: If you decide to refactor to domains, don’t go overboard with it: not only every little feature deserves its own domain. For a maintainer, it should be easy to guess which logic is in which domain.
🚀 I'm proud to share that our team has released a new major version of Ignition. It's the most beautiful error page you ever seen, and it will be the default in @laravelphp 9
👍You can also install it in Laravel 8!
🧵 Let's take a look at all the features
At the top there's a new Docs item which will go straight to the Laravel documentation. That red dot means we found a very specific page (for instance the Eloquent page for query errors)
Settings can now be saved right in Ignition itself, you don't have to edit a config file.