When an HTTP request is received, it first hits your predefined Endpoint (each endpoint live in its own Route file).
After the user makes a request to the endpoint
[GET] www.api.apiato.com/v1/hello it calls the defined controller
This function takes a Request class
SayHelloRequest to automatically checks if the user has the right access to this
endpoint. Only if the user has access, it proceeds to the function body.
Then the function calls an Action (
SayHelloAction) to perform the business logic.
The Action can do anything then return a result (could be an Object, a String or anything).
When the Action finishes its job, the controller function gets ready to build a response.
Json responses can be built using the helper function
$this->json(['foo' => 'bar']);).