Laravel 7 is now out which includes many new features including Laravel Airlock, better routing speed, custom Eloquent casts, Blade component tags, fluent string operations, a new HTTP client, CORS support, and many more features.
Laravel versions itself fast, its already on stable version 7.2.2. Now First things first, Let’s first upgrade our laravel application & then see what’s new in it. 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.
Dependencies upgrade
Open up your composer.json
file and upgrade versions of the following.
"laravel/framework": "^7.2", "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.
Symfony5 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',
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"
Run composer update
Now let’s run composer update and see if everything works fine for us.
composer update