使用 laravel 安装程序安装特定版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35149812/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 17:15:10  来源:igfitidea点击:

Install specific version using laravel installer

laravel

提问by Dipendra Gurung

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?

它将创建一个具有最新版本(如 5.2)的 laravel 项目,但是如果我想安装特定版本,即。5.1版本?

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

更新::我正在寻找laravel安装程序命令,是否有特定版本安装的任何选项/参数?

回答by Tutelage Systems

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.

使用 5.1.* 将确保您获得 5.1 分支中的所有最新补丁。

回答by Jinu P C

use

laravel new blog --version

Example laravel new blog --5.1

You can also use the composer method

您也可以使用 composer 方法

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

here, app is the name of your project

在这里, app 是你的项目名称

please see the documentation for laravel 5.1 here

请在此处查看 laravel 5.1 的文档

UPDATE:

更新:

The above commands are no longer supports so please use

以上命令不再支持,请使用

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

回答by palash140

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

使用laravel new blog --5.1
确保你必须有 laravel installer 1.3.4 版本。

回答by Punit Gajjar

You can use composer method like

您可以使用 Composer 方法,例如

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

回答by Cris John Rey Tarpin

For newer version of laravel:

对于较新版本的 Laravel:

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

回答by iMezied

The direct way as mentioned in the documentation:

文档中提到的直接方式:

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

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

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