Install specific version using laravel installer

Laravel

Laravel Problem Overview


As of now, if I use this command

laravel new blog

It will create a laravel project with the latest version like 5.2, but what if I want to install a specific version, ie. version 5.1?

UPDATE:: I am looking for laravel installer command, is there is any option/parameter for specific version installation?

Laravel Solutions


Solution 1 - Laravel

Using composer you can specify the version you want easily by running

composer create-project laravel/laravel="5.1.*" myProject

Using the 5.1.* will ensure that you get all the latest patches in the 5.1 branch.

Solution 2 - Laravel

use

laravel new blog --version

Example laravel new blog --5.1

You can also use the composer method

composer create-project laravel/laravel app "5.1.*"

here, app is the name of your project

please see the documentation for laravel 5.1 here

> UPDATE:

The above commands are no longer supports so please use

composer create-project laravel/laravel="5.1.*" appName

Solution 3 - Laravel

You can use composer method like

composer create-project laravel/laravel blog "5.1"

Or here is the composer file

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.1.*"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "pre-update-cmd": [
            "php artisan clear-compiled"
        ],
        "post-update-cmd": [
            "php artisan optimize"
        ],
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

Solution 4 - Laravel

use laravel new blog --5.1
make sure you must have laravel installer 1.3.4 version.

Solution 5 - Laravel

The direct way as mentioned in the documentation:

composer create-project --prefer-dist laravel/laravel blog "6.*"

https://laravel.com/docs/6.x/installation

Solution 6 - Laravel

Via composer installing specific version 8.*

composer create-project laravel/laravel:^8.0 project_name

using composer installing specific version 7.*

composer create-project --prefer-dist laravel/laravel:^7.0 project_name

To install specific version 6.* and below use the following command:

composer create-project --prefer-dist laravel/laravel project_name "6.*"

Solution 7 - Laravel

For newer version of laravel:

composer create-project --prefer-dist laravel/laravel=5.5.* project_name

Solution 8 - Laravel

From Laravel 6, Now It's working with the following command:

composer create-project --prefer-dist laravel/laravel:^7.0 blog

Solution 9 - Laravel

Year 2022

Since Laravel 5.2 (2017) it is not possible to install a specific Laravel Version via Laravel Installer. Use instead composer create-project. For example:

composer create-project --prefer-dist laravel/laravel blog "7.*"

// That will install Version the latest version of Laravel 7.
// would install: 
"laravel/framework": "^7.29",

composer create-project --prefer-dist laravel/laravel blog "5.*"

// would install:
"laravel/framework": "5.8.*",

composer create-project --prefer-dist laravel/laravel blog

Would install the latest Laravel version on your local machine.

Solution 10 - Laravel

you can find all version install code here by changing the version of laravel doc

composer create-project --prefer-dist laravel/laravel yourProjectName "5.1.*"

above code for creating laravel 5.1 version project. see more in laravel doc. happy coding!!

Solution 11 - Laravel

composer create-project --prefer-dist laravel/laravel project_name "version_num"

Example :: suppose, i would like to create a new project called- blog where i would like to use laravel 6.0 LTS version,, following that command

composer create-project --prefer-dist laravel/laravel blog "6.*"

Solution 12 - Laravel

you can use this command

composer create-project laravel/laravel:^8.*.* exam-app

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDipendra GurungView Question on Stackoverflow
Solution 1 - LaravelTutelage SystemsView Answer on Stackoverflow
Solution 2 - LaravelJinu P CView Answer on Stackoverflow
Solution 3 - LaravelPunit GajjarView Answer on Stackoverflow
Solution 4 - Laravelpalash140View Answer on Stackoverflow
Solution 5 - LaraveliMeziedView Answer on Stackoverflow
Solution 6 - LaravelVishal VaghasiyaView Answer on Stackoverflow
Solution 7 - LaravelCris John Rey TarpinView Answer on Stackoverflow
Solution 8 - LaravelRakib13View Answer on Stackoverflow
Solution 9 - LaravelMaik LowreyView Answer on Stackoverflow
Solution 10 - LaravelAbidView Answer on Stackoverflow
Solution 11 - LaravelCsJoyView Answer on Stackoverflow
Solution 12 - LaravelAmin NazemiView Answer on Stackoverflow