Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing specific laravel version with composer create-project

The fastest and simplest way of installing Laravel is via composer command. From the laravel docs (http://laravel.com/docs/quick), it shows that we can install it with this:

composer create-project laravel/laravel your-project-name --prefer-dist 

But, when you run the above command, it will grab the latest version of Laravel. How can I control it if I want to install latest version of 4.0.x? Or, 4.1.x when 4.2 is out?

like image 358
user1995781 Avatar asked May 20 '14 08:05

user1995781


People also ask

How do I create a specific version of Laravel project?

You can also specify the version with the package name using = or : as separator. To install unstable packages, either specify the version you want, or use the --stability=dev (where dev can be one of RC, beta, alpha or dev). This works with the * notation. I tried laravel/laravel=5.8.

How do I install an older version of Laravel?

To install the old version of Laravel, the easiest way is to use the composer create-project command. Using this command we only have to specify the project name and Laravel version that we want it to be installed and there you go it's ready.


2 Answers

From the composer help create-project command

The create-project command creates a new project from a given
package into a new directory. If executed without params and in a directory with a composer.json file it installs the packages for the current project.
You can use this command to bootstrap new projects or setup a clean
version-controlled installation for developers of your project.

[version]
You can also specify the version with the package name using = or : as separator.

To install unstable packages, either specify the version you want, or use the --stability=dev (where dev can be one of RC, beta, alpha or dev).

This command works:

composer create-project laravel/laravel=4.1.27 your-project-name --prefer-dist 

This works with the * notation.

like image 199
edi9999 Avatar answered Oct 03 '22 20:10

edi9999


Have a look:

Laravel 4.2 Documentation

Syntax (Via Composer):

composer create-project laravel/laravel {directory} 4.2 --prefer-dist 

Example:

composer create-project laravel/laravel my_laravel_dir 4.2 

Where 4.2 is your version of laravel.

Note: It will take the latest version of Laravel automatically If you will not provide any version.

like image 36
Pratik Butani Avatar answered Oct 03 '22 20:10

Pratik Butani