Services

With the lean controller pattern we split our business logic out into services, these files we add to the App/Services/ directory ex: app/Services/Users/UserProfileService.php Also remember to keep the services lean and rather create more seperate concerns than dumping all logic into the a single file which is not solving clean code it is just transferring the problem to other files. Single Responsability Principle.

Example:

  • Users/UserProfileService.php
  • Users/UserAddressService.php
  • Users/UserSubscriptionService.php
  • Users/UserContactService.php

This will help alot when passing services into Jobs that need to be small in size to process faster. Service, Jobs, etc should have one specific responsability.