In February 2022 a new version of Laravel was released. There are some new and exciting changes in the new version.
Laravel 9 New Features:
- Minimum PHP Requirement (at least php 8.0)
- Anonymous Stub Migration
- New Query Builder Interface
- Custom Casts & null
- PHP 8 String Functions
- Flysystem 2.0
- The lang Directory
- Symfony Mailer
- Default HTTP Client Timeout
- The Password Rule
- Improved Route List Console View
Update
To upgrade your Laravel application, you will need to replace the following packages with these updated versions in your composer.json file
Laravel version
"laravel/framework": "^9.0",
Nunomaduro collision
"nunomaduro/collision": "^6.1",
Find facade/ignition and replace it with
"spatie/laravel-ignition": "1.0",
Some other dependencies you might have to update include
"algolia/scout-extended": "^2.0",
"laravel/scout": "^9.1",
"spatie/laravel-permission": "^5.5",
You should be able to run
composer update
You might have to remove vendor folder and composer.lock file.
Proxies issue
You might get an error such as
Undefined constant Illuminate\Http\Request::HEADER_X_FORWARDED_ALL
to fix this go to app/Http/Middleware/TrustProxies.php
and change
use Fideloper\Proxy\TrustProxies as Middleware
to
use Illuminate\Http\Middleware\TrustProxies as Middleware;
Laravel Guide
If you happen to get any other issues during the upgrade Laravel does a great job with their docs and their upgrade guide.
Remember that with new Laravel requiring php 8.0 you might have to update your files if you were using lower php versions.