Laravel
Services
With the lean controller pattern we split our business logic out into services. These files go in the app/Services/ directory, e.g. app/Services/Users/UserProfileService.php. Also remember to keep the services lean, and rather create more separate concerns than dump all the logic into a single file — that is not clean code, it just moves the problem to another file. See the Single Responsibility Principle.
Example:
- Users/UserProfileService.php
- Users/UserAddressService.php
- Users/UserSubscriptionService.php
- Users/UserContactService.php
This helps a lot when passing services into jobs, which need to stay small so they process faster. Services, jobs, etc. should each have one specific responsibility.
