In the following section, we will explain how to validate the input data in our microservice and how to manage the possible errors. It is important to filter the request we are receiving--not only to notify the consumer that the request was not valid, but also to avoid security problems or parameters that we are not expecting.
Lumen has a fantastic validation system, so we do not need to install anything to validate our data. Note that the following validation rules can be placed on the
routes.php or on the controller inside every function. We will use it inside the function to be clearer.
To use our database for the validation system, we need to configure it. This is very simple; we just need to create a