phplaravellaravel-4.2

How can i Update my laravel to latest version(8 or above)


Currently I am using Laravel 4.2.

I have tried this command - composer global require laravel/installer It is installing the 4.2 Version itself. I need to update it to the latest version. Any suggestions..

My PHP version is 7.3


Solution

  • If you meant upgrade Laravel installer, just reinstall

    composer global remove laravel/installer 
    composer global require laravel/installer
    

    4.2 is the latest version of the installer(not the framework), you could install Laravel framework 8.0 using Laravel installer 4.2 https://packagist.org/packages/laravel/installer

    You can create a Laravel 8 project using the below command:

    laravel new example-app
    cd example-app
    php artisan --version
    

    php artisan --version should show the latest version of the Laravel framework

    If you meant to upgrade your current Laravel 4.2 project to 8.0, you need to upgrade to 5(5.0 - 5.8) first, then 6, then 7, and then 8.

    Below is how to upgrade from 4.2 to 5.0 https://laravel.com/docs/5.0/upgrade#upgrade-5.0

    But the path is too long, it's better to create new latest one and just copy-paste the route and controller.