Wrapping up

A RESTful API provides an easy way to expand the program in the future and also integrates with third-party programs and software that exist within a company that might need to communicate with the application. The RESTful API is the front-most shell of the inner part of the program and provides the bridge between the outside world and the application itself. The inner part of the program will be where all of the business logic and database connections will reside, so fundamentally, the controllers simply have the job of connecting the routes to the application.

Laravel follows the RESTful best practices, thus documenting the API should be easy enough for other developers and third-party integrators to understand. Laravel 5 has brought a few features in to the framework to enable the code to be more readable.

In future articles, middleware will be discussed. Middleware adds various “middle” layers between the route and the controller. Middleware can provide features such as authentication. Middleware will enrich, protect, and help organize the routes into logical and functional groups.

We will also discuss DocBlock annotations. Annotations, while not natively supported in PHP, can be enabled via a Laravel community package. Then, inside the DocBlock of the controller and controller functions, the routing for each controller is automatically created, without having to actually modify theapp/Http/routes.php file. This is another great community concept that Laravel easily adapts to, in the same manner as phpspec and Behat.