How to Upgrade My Laravel Project to Latest Version?

11-Sep-2023

.

Admin

How to Upgrade My Laravel Project to Latest Version?

Hi dev,

Upgrading a Laravel project to the latest version involves a series of steps to ensure a smooth transition and minimize any potential issues. Here's a step-by-step guide on how to upgrade your Laravel project to the latest version

Guide to upgrading Laravel project to the latest version, including step-by-step instructions for optimization and upgrade to the latest Laravel framework version.

Let's see the following steps:

Step 1: Update PHP version


PHP 8.1 is the minimum-required PHP version in Laravel 10. Some PHP 8.1 features, such as readonly properties and array_is_list, are used in Laravel 10.

sudo update-alternatives --config php

Step 2: Composer Version Update

Laravel 10 requires Composer 2.2. 0 or greater. If you using a lower version, uninstall and install a new version. We already have the composer version above 2.2.

sudo composer self-update 2.1.3

sudo composer self-update 2.5.8

Step 3: Update Composer Dependencies

composer.json

{

"name": "laravel/laravel",

"description": "The Laravel Framework.",

"keywords": ["framework", "laravel"],

"license": "MIT",

"type": "project",

"require": {

"php": "^8.1",

"intervention/image": "^2.3",

"laravel/framework": "^10.10",

"laravel/tinker": "^2.8",

"laravel/ui": "^4.2",

"laravelcollective/html": "^6.4",

"maatwebsite/excel": "^3.1",

"yajra/laravel-datatables-oracle": "^10.8"

},

"require-dev": {

"filp/whoops": "^2.14",

"fzaninotto/faker": "^1.4",

"mockery/mockery": "^1.0",

"nunomaduro/collision": "^6.3",

"phpunit/phpunit": "^10.1"

},

"autoload": {

"classmap": [

"database/seeders",

"database/factories"

],

"psr-4": {

"App\\": "app/"

},

"files": [

"app/Http/helpers.php"

]

},

"autoload-dev": {

"psr-4": {

"Tests\\": "tests/"

}

},

"extra": {

"laravel": {

"dont-discover": [

]

}

},

"scripts": {

"post-root-package-install": [

"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""

],

"post-create-project-cmd": [

"@php artisan key:generate"

],

"post-autoload-dump": [

"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",

"@php artisan package:discover"

]

},

"config": {

"preferred-install": "dist",

"sort-packages": true,

"optimize-autoloader": true

},

"minimum-stability": "dev",

"prefer-stable": true

}

Step 4: Laravel - Class "Fideloper\Proxy\TrustProxies" not found

composer require fideloper/proxy

Step 5: Composer Update

compose update

Run Laravel App:

All the required steps have been done, now you have to type the given below command and hit enter to run the Laravel app:

php artisan serve

Now, Go to your web browser, type the given URL and view the app output:

http://localhost:8000/

I hope it can help you...

#Laravel 10