Decoding The All New Laravel
Table of Contents
Laravel is the most popular PHP framework in 2016. It’s free, open-source and built for MVC architecture. It mainly focuses on elegance, simplicity, readability and relies on modular packaging system and utilities that help in database and application maintenance and deployment. Its source code is hosted on GitHub and can be used across all operating systems.
The latest stable version Laravel 5.3 is now available and the Laravel team has added a lot of features for improving developer speed by adding additional out of the box improvements for common tasks.
- Laravel Scout – New driver based solution for adding advanced search and full-text search to Eloquent models. It automatically keeps the search indexes in sync with Eloquent records by using model observers. It currently ships with an Algolia driver, however, can be easily extended with other search implementations.
- Laravel Passport – Native OAuth2 server and API authentication package built on top of the League OAuth2 Server maintained by Alex Bilbie.
- Laravel Mailable – PHP classes for sending emails.
- Laravel Notifications – API for sending notifications across a variety of delivery channels, mail, SMS (via Nexmo) and Slack.
- Laravel Echo – A Javascript package installable via NPM which provides an API for subscribing to channels and listening for server-side events in client-side JavaScript application. It includes support for Pusher and Socket.io.
- Laravel Elixir – The new version (6.0) contains baked-in support for the Webpack and Rollup Javascript module bundlers.
Few of the upcoming features in next version (5.4) of Laravel are:
- JSON Based Language Files – For better support and handling of multilingual project requirements and applications.
- Laravel Blade Components & Slots – Ability to add Components & Slots to Blade templates.
- Higher Order Messaging For Collections
Compared to Laravel 5.2, there are few changes also in Laravel 5.3 which are worth mentioning:
- In Laravel 5.2, the routes file (routes.php) was in the Http directory (app\Http\routes.php) whereas in Laravel 5.3, routes is a new folder (top first level) which contains two files namely web.php and api.php. Thus there is no routes.php file in Laravel 5.3 and you can set up routes for web and API separately using these two files.
- The middleware group registering file (app\Http\Kernel.php) contains separately defined middleware group for web and API in Laravel 5.3. Similarly in route service provider file (app\Providers\RouteServiceProvider.php) also, web and API specific routes are defined separately.
- The app directory in Laravel 5.3 is more simple. In Laravel 5.2, there were folders like Events, Jobs, Listeners and Policies which were not always used by default. In Laravel 5.3, these folders are not available natively and you have to run associated commands to create that on-demand.
- The Fluent Query Builder in Laravel 5.3 now returns Collection (Illuminate\Support\Collection) instances instead of plain arrays.
- There is a new cache() global helper in Laravel 5.3 which can perform three primary functions – get, put or return an instance of the backing service.
- While using the for each and for else Blade directives, $loop object is available for each iteration.
- A new toggle() method is available on all belongsToMany relationships which solves the issue of deleting an existing pivot table record or adding a new one.
- The uploaded File instance has a new store() method for storing files on the server including S3.
Laravel’s modular packaging system, user-friendliness, and elegance have generated huge interest among developers and customers worldwide and it is expected to continue staying at the top. The main benefits which this framework offer are:
- Fast and secure development.
- Well-organized, reusable and maintainable coding options.
- Scalability of web apps.
- High level security.
- Follows the OOP (Object-Oriented Programming), MVC (Model-View-Controller) patterns and security which ensures the separation of presentation and logic.
- Promotes advanced and modern web development practices.
Because of its simplicity, easy learning curve, and rapid application development support, we at Capital Numbers are extensively using Laravel to develop large, robust and efficient web applications and customized solutions, REST API (using Lumen which is a stunningly fast PHP Micro-Framework by Laravel) and deliver bug-free codes by performing unit tests.