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.
Routing is one of the most important areas where the URLs need to be routed as per the requirement. URL rewriting and routing need 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 the routing process.
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 were 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 the 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.
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 root directory routes/. This directory has two files web.php and api.php, which in turn helps, distinguish the two major groups in the routing process. With this clear distinction between web routes and API routes on the application-level, there will be multiple route files, which will eventually make it easier for Laravel Developers to organize their routes.
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 an 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.
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 that may be helpful in the app that you might be creating.
We have already covered how Laravel 5.3 comes with a new folder of Routes, however, there are many folders that 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 to feel free to share and comment on our blog.
Nisarg Mehta, CEO & Chairman of Techtic Solutions, is the vision of the company. Nisarg is active in operations in his daily routine as he is one of the key decision makers in terms of technological advancements of the company. He is a friendly leader with hardworking, motivating, visionary and passionate personality.
With this eBook, avoid making mistakes & create stunning user experiences for your web and mobile apps just like LinkedIn, Starbucks, and Bank of America.
No thanks, UX is not my priority