How To Upgrade My Laravel Project to Latest Version?

Reading Time: 4 minutes
135 Views

Taking your Laravel project to the newest version demands careful steps to guarantee a seamless transition and minimize potential hiccups. Let’s dive into a comprehensive guide, walking you through the meticulous process of upgrading your Laravel project to leverage the latest enhancements and optimizations.

Explore a detailed roadmap for upgrading your Laravel project, ensuring a smooth transition while maximizing its potential with the latest advancements in the Laravel framework. Uncover step-by-step instructions that encompass optimization strategies and the complete upgrade process to embrace the latest offerings of the Laravel ecosystem.

Read More: How To Integrate ChatGPT API in Laravel 10 Tutorial

Let’s get started.

Step #1: Update PHP version

Laravel 10 has set PHP 8.1 as its minimum-required PHP version. This means that Laravel 10 harnesses the power of specific PHP 8.1 features, like readonly properties and array_is_list, to elevate its functionalities and performance.

sudo update-alternatives --config php

Step #2: Composer Version Update

In order to run Laravel 10, you’ll need Composer version 2.2.0 or higher. If your current Composer version is lower than this requirement, it’s necessary to uninstall the existing version and install a new one. If you’re already using a Composer version above 2.2, you’re all set for Laravel 10.

sudo composer self-update 2.1.3

sudo composer self-update 2.5.8	

Step #3: Update Composer Dependencies

Here, is the composer file where laravel framework version is 10.10,

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"
    },
    "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

Once you update to latest version, may be you will get “Fideloper\Proxy\TrustProxies” class not found error.

composer require fideloper/proxy	

Read More: How To Validate Image Upload in Laravel 10 Example

Step #5: Composer Update

Update your project composer,

compose update 	

Application Testing

Run this command into project terminal to start development server,

php artisan serve

URL: http://localhost:8000/

That’s it.

We hope this article helped you to learn “How To Upgrade Laravel Project to a Latest Version” in a very detailed way.

Online Web Tutor invites you to try Skillshike! Learn CakePHP, Laravel, CodeIgniter, Node Js, MySQL, Authentication, RESTful Web Services, etc into a depth level. Master the Coding Skills to Become an Expert in PHP Web Development. So, Search your favourite course and enroll now.

If you liked this article, then please subscribe to our YouTube Channel for PHP & it’s framework, WordPress, Node Js video tutorials. You can also find us on Twitter and Facebook.

Sanjay KumarHello friends, I am Sanjay Kumar a Web Developer by profession. Additionally I'm also a Blogger, Youtuber by Passion. I founded Online Web Tutor and Skillshike platforms. By using these platforms I am sharing the valuable knowledge of Programming, Tips and Tricks, Programming Standards and more what I have with you all. Read more