Language:

Search

¡Laravel v7 ya está disponible!

  • Share this:
¡Laravel v7 ya está disponible!

Upgrade Guide

First things first, Let's first upgrade our laravel application & then see what's new init. Please note that, we'll be covering from moving Laravel v6 to Laravel v7. If you're using previous versions, head over to Laravel upgrade guides and follow along.

1. Dependencies upgrade

Open up your Composer.json file and upgrade versions of the following.

"laravel/framework": "^7.0",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
"facade/ignition": "^2.0"

If you're using CORS package by Barryvdh, remove it. As Laravel v7 now comes built in with CORS package and automatically handles it for you.

2. Symfony 5 related upgrades

Laravel v7 utilizes the 5.x series of the Symfony components. Some minor changes to your application are required to accommodate this upgrade.

First, the report and render methods of your application's App\Exceptions\Handler class should accept instances of the Throwable interface instead of Exception instances:

use Throwable;
public function report(Throwable $exception)
{
 parent::report($exception);
}
public function render($request, Throwable $exception)
{
 return parent::render($request, $exception);
}

Next, please update your session configuration file's secure option to have a fallback value of null and the same_site option to have a fallback value of lax; In your session.php:

'secure' => env('SESSION_SECURE_COOKIE', null),
'same_site' => 'lax',

3. Auth Scaffolding upgrades

Laravel v7 comes in with Laravel Airlock, which manages auth scaffolding for you out of the box. You just need to install the package. If you're already using auth, you can comment out Auth::routes() from your routes to avoid any breakages

composer require laravel/ui "^2.0"

4. Run composer update

Now let's run composer update and see if everything works fine for us.

composer update

What's new in Laravel v7?

1. Laravel Airlock

Laravel Airlock provides a featherweight authentication system for SPAs (single page applications), mobile applications, and simple, token based APIs. Airlock allows each user of your application to generate multiple API tokens for their account. These tokens may be granted abilities / scopes which specify which actions the tokens are allowed to perform.

2. Easy HTTP Client

Laravel now provides an expressive, minimal API around the Guzzle HTTP client, allowing you to quickly make outgoing HTTP requests to communicate with other web applications. Laravel's wrapper around Guzzle is focused on its most common use cases and a wonderful developer experience. For example, the client makes it a breeze to POST and interface with JSON data:

use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
 'Authentication' => 'Bearer $token'
])->post('http://test.com/users', [
 'name' => 'janedoe',
]);
return $response['id'];

3. CORS Support

Laravel 7 includes first-party support for configuring Cross-Origin Resource Sharing (CORS) OPTIONS request responses by integrating the popular Laravel CORS package written by Barry vd. Heuvel. A new cors configuration is included in the default Laravel application skeleton.

There are the few major features, you can see more of the features and improvements on Laravel official website.

Usama Muneer

Usama Muneer

A web enthusiastic, self-motivated & detail-oriented professional Full-Stack Web Developer from Karachi, Pakistan with experience in developing applications using JavaScript, WordPress & Laravel specifically. Loves to write on different web technologies with an equally useful skill to make some sense out of it.