The Laravel development team has just released version 7 of the PHP framework a few months after the release of Laravel 6. It’s a significant new version of the framework with many new features, including Laravel Airlock, routing speed improvements, Blade component tags, custom Eloquent cast, a developer-oriented HTTP client, CORS first part support, etc. Here are more details about what the new version of the framework is about.
Fluent String Operations
Laravel’s Illuminate class offers a variety of useful functions for string manipulation. Laravel 7 now provides a more object-oriented and fluid string manipulation library built in addition to these functions. You can create a fluid Illuminateable object using the Str::of method. A variety of methods can then be chained to the object to manipulate the string.
Blade Component Tags and Enhancements
Blade components have been revised to allow tag-based rendering, attribute management, component classes, inline view components, etc. According to the development team, this overhaul of Blade components is significant. As such, you should refer to the complete Blade component documentation to learn more about this feature.
Custom Cast Eloquent
Laravel has a variety of integrated and useful cast types. That said, sometimes, you may need to define your own cast types. Now you can do this by defining a class that implements the CastsAttributes interface. Classes that implement this interface must define a get method and a set method. The get method is responsible for transforming a raw value from the database into a cast value, while the set method must transform a cast value into a raw value that can be stored in the database.
Laravel now provides a minimal and expressive API around the Guzzle HTTP client, allowing you to quickly make outgoing HTTP requests to communicate with other web applications. The Laravel skin around Guzzle focuses on the most common use cases and pleasant development experience.
MySQL 8 Database Queue Improvements
In previous versions of Laravel, the database queue was not considered robust enough for production use, due to blockages. However, Laravel 7 brings improvements to applications using MySQL 8+ as a database queue. By using the FOR UPDATE SKIP LOCKED clause and other SQL enhancements, the database driver can now be safely used in higher volume production applications.
Laravel Airlock provides an ultra-light authentication system for SPAs (single page application), mobile apps, and simple token-based APIs. Airlock allows each user of your app to generate several API tokens on his or her behalf. These tokens can be assigned capabilities/scales that specify the actions the tokens are allowed to perform.
Improved caching speed
Laravel 7 includes a new method for mapping compiled and cached routes that have been cached using the “artisan route:cache” command. On large applications (for example, applications with 800 or more routes), these improvements can result in a speed improvement of about twice the number of requests per second on a simple “Hello World” benchmark. You don’t need to make any changes to your application.