Laravel 5.3 has made some significant progress for this beautifully coded framework for web artisans. Some of the most valuable improvements are Mailables, Customized Pagination Templates, New JSON Column, Cache(), Routing and much more. Laravel is becoming one of the most popular and highly decorative PHP Frameworks.
What changed with Routing in Laravel 5.3
Routing is one of the most important areas where the URLs need to be routed as per the requirement. URL rewriting and routing needs to be handled highly efficiently in order to make the process seamless. Laravel has been working really hard to shift around the routing process with every version. However, they have always felt off when considering the routing until now. With Laravel 5.3 they have made some significant progress with routing and hoping to have found this as a perfect solution for routing process.
Flashback of Routing in Laravel 5.2
To dig deeper into this Looking back to Laravel 5.2 is important and how routing was working in that version and what are the significant improvements made needs to be discussed over the course of this article. In Laravel 5.2 there were two groups in routing which was noticed in routes.php, one was for web and the other for the API. The web group of routing gets all the expected normal needs for the web users like sessions, cookies, CSRF and more while API group gets the lighter version of the routes. The API group of routing comes with the Throttle middleware, making a strong case for the stateless REST API.
The Redefined Routing in Laravel 5.3
This was a great move however the Laravel 5.3 is one step ahead of this and has created a new directory structure where routes.php has turned into a root directory routes/. This directory has two files web.php and api.php, which in turn helps, distinguish the two major groups in routing process. With this clear distinction between web routes and API routes on application-level, there will be multiple route files, which will eventually make it easier for Laravel Developers organize their routes.
Introduction to $loop variable in Laravel 5.3
Laravel has a blade tempting language which provides something called directives. With the experience of writing templates with Blade, one is aware of control structures like @foreach, @if and more. The @foreach directive is a superpower as it has the new $loop variable, which is astdClass object to provide the loop information that you are currently in. The loop variable is also used as a parent reference when you are creating a loop within a loop as well, this opens up more smarter and great options for Templating.
The New cache() in Laravel 5.3
Like session(), the cache() global helper can perform three primary functions: get, put, or return an instance of the backing service. This global helper will help store the cache value using a Cache Manager. This may not be very useful but certainly a handy feature which may be helpful in the app that you might be creating.
Laravel 5.3 Revised Folder Structure
We have already covered how Laravel 5.3 comes with a new folder of Routes, however there are many folders which have gone away namely:
There are also new folders that won’t show up on a new install but might show up after you use Artisan generators: app/Mail for Mailables and app/Notifications for Notifications.
Feel free to discuss your thoughts on the new Laravel 5.3 and if you still feel that the newer versions may need certain improvements feel free to share and comment on our blog.