The Service layer contains classes to serve applications, or simply provides a framework for the application. The application layer will communicate with this layer to have all sorts of application services, such as user authentication, user information registration, login session validation, and form validation. For a better understanding, we will keep our service classes inside a separate directory named
Service and use the namespace
My\Service, for the classes of this layer.
This class will perform validation tasks, such as form validation and login information validation, and also save to deliver form error messages and field values.