如何使用 Composer 安装 Laravel 4
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28516701/
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
How to install Laravel 4 using composer
提问by Adrian Enriquez
When laravel 5 is not yet released, I install Laravel 4 using this command composer create-project laravel/laravel your-project-name --prefer-dist
. But now when I use it, It installs laravel 5. I just want to use laravel 4, not yet ready for 5.
当 Laravel 5 尚未发布时,我使用此命令安装 Laravel 4 composer create-project laravel/laravel your-project-name --prefer-dist
。但是现在我用的时候,它安装了laravel 5。我只想用laravel 4,还没准备好用5。
回答by Adrian Enriquez
I've tried the other answers but doesn't work for me. So here's the command I use.
我已经尝试了其他答案,但对我不起作用。所以这是我使用的命令。
composer create-project laravel/laravel=4.1.27 your-project-name --prefer-dist
composer create-project laravel/laravel=4.1.27 your-project-name --prefer-dist
Source : Installing specific laravel version with composer create-project
来源: 使用 composer create-project 安装特定的 laravel 版本
UPDATE
更新
Laravel updated the installation docs of 4.* after releasing 5.
Laravel 5 发布后更新了 4.* 的安装文档。
composer create-project laravel/laravel {directory} 4.2 --prefer-dist
composer create-project laravel/laravel {directory} 4.2 --prefer-dist
回答by lukasgeiter
If nothing specified composer create-project
will get the latest stable version. You can change that by just specifying the version you want:
如果没有指定composer create-project
将获得最新的稳定版本。你可以通过指定你想要的版本来改变它:
composer create-project laravel/laravel project-name ~4.2.0 --prefer-dist
This will install the latest 4.2.*
version of laravel
这将安装最新4.2.*
版本的 Laravel
回答by Gal
You should download latest laravel 4.2 release from github - https://github.com/laravel/laravel/releases/tag/v4.2.11then use composer update
to download all relevant packages including latest laravel version
您应该从 github 下载最新的 laravel 4.2 版本 - https://github.com/laravel/laravel/releases/tag/v4.2.11然后用于composer update
下载所有相关包,包括最新的 laravel 版本
回答by Kavin
I use Alternate Method.
我使用替代方法。
Docs says Alternate Method
文档说替代方法
Once Composer is installed, download the 4.2 version https://github.com/laravel/laravel/archive/v4.2.11.zipof the Laravel framework and extract its contents into a directory on your server. Next, in the root of your Laravel application, run the php composer.phar install (or composer install) command to install all of the framework's dependencies. This process requires Git to be installed on the server to successfully complete the installation.
安装 Composer 后,下载Laravel 框架的 4.2 版本https://github.com/laravel/laravel/archive/v4.2.11.zip并将其内容解压缩到服务器上的目录中。接下来,在 Laravel 应用程序的根目录中,运行 php composer.phar install(或 composer install)命令来安装框架的所有依赖项。此过程需要在服务器上安装 Git 才能成功完成安装。
If you want to update the Laravel framework, you may issue the php composer.phar update command.
如果你想更新 Laravel 框架,你可以发出 php composer.phar update 命令。
回答by Miguel Carvajal
U can use this
你可以用这个
composer create-project laravel/laravel {directory} 4.2 --prefer-dist
作曲家创建项目 laravel/laravel {directory} 4.2 --prefer-dist
replacing {directory} with the actual directory of your project
用项目的实际目录替换 {directory}