php 在 xampp 中使用 composer 安装 Laravel 4.1
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23881891/
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
Laravel 4.1 installation with composer in xampp
提问by Veshraj Joshi
I wanted to try out the Laravel 4.1
but unfortunately got stuck at the very beginning. When i try to install it using composer
as mentioned in the Laravel 4.1 documentation
, i get the following error
while running "composer create-project laravel/laravel laravelProject --prefer-dist":
我想尝试一下,Laravel 4.1
但不幸的是一开始就卡住了。当我尝试使用composer
中提到的方法安装它时Laravel 4.1 documentation
,我error
在运行时得到以下信息"composer create-project laravel/laravel laravelProject --prefer-dist":
[Composer\Downloader\TransportException]
The "http://packagist.org/p/illuminate/filesystem$a5912ddb14272c0efa16e821a25bb68e39d3bac736aee7de62cb5641fd7133e3.json" file could not be downloaded:
failed to open stream: HTTP
request failed!
[Composer\Downloader\TransportException]
无法下载
“ http://packagist.org/p/illuminate/filesystem$a5912ddb14272c0efa16e821a25bb68e39d3bac736aee7de62cb5641fd7133e3.json”文件:无法打开流:HTTP
请求失败!
回答by ravichand
Four simple steps to install laravel on windows machine:
在windows机器上安装laravel的四个简单步骤:
- After installing xampp, just download composer from https://getcomposer.org/download/and install it.
- goto path C:/xampp/htdocs and create a folder as laravel, redirect to laravel using cmd prompt as cd c:\xampp\htdocs\laravel.
- then simply type this command to create a first project composer create-project laravel/laravel first-project --prefer-distReplace first-project with your project name(it takes a few minutes to install)
- then redirect to localhost/laravel/first-project/public/ and now you can see the Laravel logo along with a quick message saying “You have arrived.” ( always use a public folder to access project )
- 安装 xampp 后,只需从https://getcomposer.org/download/下载 composer并安装它。
- 转到路径 C:/xampp/htdocs 并创建一个文件夹作为 laravel,使用 cmd 提示符重定向到 laravel 作为 cd c:\xampp\htdocs\laravel。
- 然后只需输入此命令即可创建第一个项目composer create-project laravel/laravel first-project --prefer-dist将 first-project 替换为您的项目名称(安装需要几分钟)
- 然后重定向到 localhost/laravel/first-project/public/,现在您可以看到 Laravel 徽标以及一条简短的消息“您已经到达”。(始终使用公共文件夹访问项目)
回答by Vinoth Kumar
Few steps to install for Windows Xampp,
为 Windows Xampp 安装的几个步骤,
- Download Composer here http://getcomposer.org/
- Download master copy here https://github.com/laravel/laravel/archive/master.zip
- Paste the master in xampp/htdocs/your-project-name/[paste the master copy of laravel here]
- Go to Command prompt : Start Menu -> Run -> Type cmd or command or Window Key + R and type cmd or command.
- Go the path xampp/htdocs/your-project-name/ in command prompt and type composer install.
- It will automatically download the necessary files.
- 在此处下载 Composer http://getcomposer.org/
- 在此处下载主副本https://github.com/laravel/laravel/archive/master.zip
- 将master粘贴到xampp/htdocs/your-project-name/[这里粘贴laravel的master copy]
- 转到命令提示符:开始菜单 -> 运行 -> 键入 cmd 或 command 或 Window Key + R 并键入 cmd 或 command。
- 在命令提示符中转到路径 xampp/htdocs/your-project-name/ 并键入 composer install。
- 它将自动下载必要的文件。
Hope this will help.
希望这会有所帮助。
回答by govindak
Go to: https://github.com/laravel/laravel
前往:https: //github.com/laravel/laravel
Click on download in the right side of the page, unzip the file and move everything to the folder that will run the website. Use the installation notes to be sure to create a public_html directory, this is where you have to publish css and javascript files.
单击页面右侧的下载,解压缩文件并将所有内容移动到将运行该网站的文件夹中。使用安装说明确保创建一个 public_html 目录,这是您必须发布 css 和 javascript 文件的地方。
Another method consists into the installation of Composer:
另一种方法是安装 Composer:
http://getcomposer.org/doc/00-intro.md#installation-windows
And then run this command from the prompt of commands (cmd.exe):
然后从命令提示符 (cmd.exe) 运行此命令:
composer create-project laravel/laravel --prefer-dist .
Where the dot is the path in which you want to install the framework.
其中点是您要安装框架的路径。
or simply follow the below step: Forcing composer to use https connections to Packagist Been having problems with composer from behind a company firewall. The firewall was blocking us from accessing a particular package.json file from the http://packagist.orgwebsite
或者只需按照以下步骤操作: 强制 Composer 使用 https 连接到 Packagist 在公司防火墙后面使用 Composer 时遇到问题。防火墙阻止我们从http://packagist.org网站访问特定的 package.json 文件
What was strange though was that it was only blocked over http:// connections and perfectly accessible from https:// connections.
但奇怪的是,它只能通过 http:// 连接被阻止,并且可以从 https:// 连接完全访问。
However, I have, after much trial and error and research, found a workaround. It's not a particularly graceful workaround but it takes advantage of the fact that composer does not recursively resolve repository locations and only takes commands from the main project's composer.json configuration.
但是,经过多次反复试验和研究,我找到了一种解决方法。这不是一个特别优雅的解决方法,但它利用了 Composer 不会递归解析存储库位置并且只从主项目的 composer.json 配置中获取命令的事实。
I realised when reading the documentation on the composer github site that you could disable the default packagist configuration. In addition, of course you can add your own repositories to the composer.json in your project.
在阅读 composer github 站点上的文档时,我意识到您可以禁用默认的 packagist 配置。此外,您当然可以将自己的存储库添加到项目中的 composer.json 中。
So, adding the following to the composer.json solves the problem and I'm able to bypass the blocks put in place by the firewall.
因此,将以下内容添加到 composer.json 解决了问题,我可以绕过防火墙设置的块。
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{ "packagist": false }
hopefully this will help.
希望这会有所帮助。
回答by Dadu Laal
In my case in installed laravel 5.2 with php 7
在我的情况下,安装了带有 php 7 的 laravel 5.2
Very Simple:
很简单:
If you have working XAMPP on your machine with latest php version
如果您的机器上安装了最新的 php 版本的 XAMPP
- Download the Composer from official site
- 从官方网站下载 Composer
install by following simple steps.
按照以下简单步骤安装。
To verify the installation Open Command Prompt (Window + R key and type cmd ) then type
composer
要验证安装打开命令提示符(Window + R 键并键入 cmd )然后键入
作曲家
Note: it is not necessary where you are in directory path of Command Prompt. Composer is globally accessible in Command Prompt.
注意:不需要您在命令提示符的目录路径中。Composer 可在命令提示符中全局访问。
you will see the details about composer and their respective version.
您将看到有关 composer 及其各自版本的详细信息。
After successfully installing composer install laravel by just typing the command: Ensure your working Internet
composer global require "laravel/installer"
成功安装 composer install laravel 后,只需输入以下命令: 确保您的 Internet 工作正常
composer global 需要“laravel/installer”
it will automatically download from their server and also his Dependencies.
它将自动从他们的服务器以及他的依赖项下载。