written by
Aidan Perera

Laravel 7: It's Kind of a Big Deal

Code 3 min read

The leading PHP framework just got even better with Laravel 7.

Laravel is an open-source PHP framework that utilises a Model-View-Controller (MVC) design pattern. It's a robust and easy to understand framework that helps in designing more structured and powerful web applications.

There are a lot of big changes that come with the release of Laravel 7, and it's kind of a big deal. The update continues on the improvements made in Laravel 6.x only 6 months ago (Read more about Laravel 6). It includes new features and improvements that are beneficial for developers and businesses alike.

Laravel 7
Source: Laravel 7 is now released!

It's all about simplicity and efficiency.

Some of the more notable features introduced are:

  • Laravel Airlock routing
  • Speed improvements
  • Custom Eloquent casts
  • Blade component tags
  • Fluent string operations
  • Developer-focused HTTP client,
  • First-party CORS support,
  • Improved scoping for route model binding

It's a big update so without further adieu, let's jump into all the game-changing features.

Laravel Airlock

Laravel Airlock is a new addition in Laravel 7. It provides a featherweight authentication system for single-page applications (SPAs), mobile applications, and simple token-based APIs.

Source: Laravel Airlock

Airlock solves the two main problems:

  1. Token-based authentication
  2. Secure SPA authentication.

The package now allows for the simple issuing of API tokens to users without the overhead of OAuth. The tokens can be granted abilities or scopes which specify which actions the tokens are allowed to perform.

Airlock also offers a simple way to authenticate SPAs that need to interact with a Laravel powered API.

Routing speed improvements

Laravel 7 includes a new method of matching compiled, cached routes that have been cached using the route: cache Artisan command. This routing improvement will be significantly noticeable on large scale projects that include hundreds of routes.

Based on simple requests benchmarks, these improvements can result in 2 times more routing speed.

Custom eloquent casts

Laravel already has a variety of built-in, helpful cast types. But in some cases, you may need to define your own cast types. This is where the new custom eloquent casts come in to play. This can be easily accomplished in Laravel 7 by defining a class that implements the new CastsAttributes interface.

Supercharged Blade Components

One of the most useful features that have a lot of developer's heads turning is the overhaul to the Blade components. Just to give you an idea of how extensive the overhaul is, the official release notes only covered a small portion of it.

In Laravel 7, Blade components have been overhauled to allow tag-based rendering, attribute management, component classes, inline view components, and more.

A component may now have an associated class that contains the data it can accept. All public properties and methods defined within the component class will be accessible to the component view.

Check out this video by Jeffrey Way about the updates on Blade components.

HTTP Client

Making HTTP requests has never been easier. Laravel 7 now provides an expressive, minimal API around the Guzzle HTTP client. In turn, allowing developers to quickly make outgoing HTTP requests. Laravel’s wrapper around Guzzle is focused on the most common use cases. This provides a nicer syntax for 90 per cent of use cases.

Fluent String Operations

Laravel already has a lot of helpful functions for manipulating strings. The new update now extends this to a more object-oriented, fluent string manipulation library built on top of these functions.

Wait... There's More

Some other notable features included and definitely should not be overlooked are:

  • Mail markdown templates
  • Stub customisation
  • Database queue improvements
  • Multiple mail drivers
  • CORS Support
  • Query-time casts
  • New artisan test command
  • Variety of other bug fixes
  • Usability improvements.

For more detailed information about the update, I suggest checking out the official documentation on Laravel 7.

At Fonseka Innovations, we are experts in the Laravel framework. We have developed and maintained many high level and robust applications with the help of our experienced team of developers.

Laravel 7
Fonseka Innovations | Laravel Experts
development web laravel 7 applicaiton website technology php web technologies laravel app web developement app developement