Home >PHP Framework >Laravel >Introduction to Laravel 7 new features and changes

Introduction to Laravel 7 new features and changes

藏色散人
藏色散人forward
2020-07-14 13:08:113243browse

The following is the tutorial column of Laravel to introduce you to the new features and changes of Laravel 7. I hope it will be helpful to friends in need!

Introduction to Laravel 7 new features and changes

Laravel 7 is a non-LTS version. Currently, only Laravel 6 and 5.5 are LTS versions.

Route Caching Speed ​​Up

Improving the performance of Laravel is a top priority. Laravel 7 claims to have improved the speed of Route Caching.

Taking the simplest Hello World as an example, the speed is increased by twice. However, it is a drop in the bucket.

Built-in HTTP Client

It is actually an encapsulation of Guzzle. This is much more convenient. You no longer need to manually import Guzzle.

use Illuminate\Support\Facades\Http;

$response = Http::post('url', [
    'name' => 'Laravel',
]);

echo $response['foo'];

$response->body()
$response->json()
$response->status()

Customized Eloquent Casts

I have no need for this yet, the built-in cast type already meets my needs.

Laravel Airlock

An API authentication system designed for single-page applications and mobile APPs. A single user can generate multiple tokens at the same time.

It’s useless. Before Laravel can’t solve the performance problem, who will use Laravel to provide API services.

String chain operation

return (string) Str::of('  Laravel Framework 6.x ')
                    ->trim()
                    ->replace('6.x', '7.x')
                    ->slug();

Summary

Overall, I still have no urge to upgrade Laravel 7, after all, it is a non-LTS version. Moreover, the current scenarios for using Laravel are mostly multiple web projects on one server, and upgrading many historical projects is of little significance.

The above is the detailed content of Introduction to Laravel 7 new features and changes. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete