How to install, upgrade or downgrade a specific version of Laravel?

Laravel Installation

Parth Patel
In Laravel
2 min readJun 1, 2020

--

Install, Upgrade or Downgrade Laravel

Laravel keeps releasing new updates every few months. But, sometimes we have to use laravel’s specific version to support the third-party packages. And it is totally fine if we want to use a lower version because some packages are not always updated and supported by laravel’s latest version.

So, let’s begin without wasting any of your precious time. Assuming that you have already installed composer on your local machine.

Installing a specific version

Open your terminal window ( Mac OS/ Linux Users ) or command prompt ( Windows Users )

If you want to install a specific major version for laravel:

composer create-project laravel/laravel your-project-name 5.8

If you want to install a specific minor version for laravel:

composer create-project laravel/laravel your-project-name 5.8.1

If you want to install the latest major version for laravel:

composer create-project laravel/laravel your-project-name 5.*

If you want to install a latest minor version for laravel:

composer create-project laravel/laravel your-project-name 5.8.*

If you want to install a specific major version for laravel:

composer create-project laravel/laravel your-project-name 5.8

Upgrading or Downgrading to a specific version

Upgrading or downgrading is always a tough and complex task to perform because of inter-related third-party packages and functions.

I suggest not to upgrade manually because it may consume your massive amount of time if you don’t know things properly.

One can use paid services like Laravel Shift. But, I have some easier ways which you can follow if you really want to give it a try by yourself.

Update your composer.json file with the desired version of laravel. Also, check if your desired version requires a specific PHP version to run it.

"require": {
"php": "^7.2",
"laravel/framework": "5.8.*",
},

Now, delete your vendor folder and composer.lock file inside your project folder.

Here is the Laravel Upgrade Guide where you can verify the functions that need to be updated at the code level. If you are upgrading, then you need to add the listed updated functions of the higher version from the guide. And if downgrading, you need to remove the updated functions from your code if you have used any from the higher version.

Then, run the following command inside your project folder:

composer install

Now, turn on the server and test if everything is working fine. If yes, then you have successfully upgraded or downgraded your laravel version.

That’s all folks! Let me know in the comment section if you have any questions. I will be happy to help you out!

Give a clap, if helped! :)

--

--

Parth Patel
In Laravel

Author | Full Stack Developer at Community Agency