php 使用 composer create-project 安装特定的 laravel 版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23754260/
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-08-25 16:54:34  来源:igfitidea点击:

Installing specific laravel version with composer create-project

phplaravelcomposer-php

提问by user1995781

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:

安装 Laravel 最快最简单的方法是通过 composer 命令。从 laravel 文档(http://laravel.com/docs/quick),它表明我们可以通过以下方式安装它:

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?

但是,当您运行上述命令时,它将获取最新版本的 Laravel。如果我想安装最新版本的 4.0.x,我该如何控制它?或者,当 4.2 出来时 4.1.x?

回答by edi9999

From the composer help create-projectcommand

composer help create-project命令

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).

create-project 命令从给定的
包创建一个新项目到一个新目录中。如果在没有 params 的情况下执行并且在包含 composer.json 文件的目录中执行,它将安装当前项目的包。
您可以使用此命令来引导新项目或
为项目的开发人员设置一个干净的版本控制安装。

[version]
您还可以使用 = 或 : 作为分隔符指定带有包名称的版本。

要安装不稳定的软件包,请指定您想要的版本,或使用 --stability=dev(其中 dev 可以是 RC、beta、alpha 或 dev 之一)。

This command works:

此命令有效:

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

This works with the * notation.

这适用于 * 符号。

回答by Pratik Butani

Have a look:

看一看:

Laravel 4.2 Documentation

Laravel 4.2 文档

Syntax (Via Composer):

语法(通过 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.

其中 4.2 是您的 Laravel 版本。

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

注意:如果您不提供任何版本,它将自动采用最新版本的 Laravel。

回答by José Bispo

Try via Composer Create-Project

通过 Composer Create-Project 尝试

You may also install Laravel by issuing the Composer create-project command in your terminal:

您还可以通过在终端中发出 Composer create-project 命令来安装 Laravel:

composer create-project laravel/laravel {directory} "5.0.*" --prefer-dist

回答by Toshi

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

And then you probably need to install all of vendor packages, so

然后你可能需要安装所有的供应商包,所以

composer install

回答by Faruk Ahmed

To install specific version of laravel try this & simply command on terminal

要安装特定版本的 laravel 试试这个 & 简单的命令在终端

composer create-project --prefer-dist laravel/laravel:5.5.0 {dir-name}

回答by OlaJ

If you want to use a stable version of your preferred Laravel version of choice, use:

如果您想使用首选 Laravel 版本的稳定版本,请使用:

composer create-project --prefer-dist laravel/laravel project-name "5.5.*"

That will pick out the most recent or best update of version 5.5.* (5.5.28)

这将挑选出版本 5.5.* (5.5.28) 的最新或最佳更新