简体   繁体   English

在xampp中使用composer安装Laravel 4.1

[英]Laravel 4.1 installation with composer in xampp

I wanted to try out the Laravel 4.1 but unfortunately got stuck at the very beginning. 我想试试Laravel 4.1但不幸的是在开始时卡住了。 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": 当我尝试使用安装它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请求失败!

Four simple steps to install laravel on windows machine: 在Windows机器上安装laravel的四个简单步骤:

  1. After installing xampp, just download composer from https://getcomposer.org/download/ and install it. 安装xampp后,只需从https://getcomposer.org/download/下载作曲家并安装即可。
  2. goto path C:/xampp/htdocs and create a folder as laravel, redirect to laravel using cmd prompt as cd c:\\xampp\\htdocs\\laravel. 转到路径C:/ xampp / htdocs并创建一个文件夹作为laravel,使用cmd提示符重定向到laravel作为cd c:\\ xampp \\ htdocs \\ laravel。
  3. then simply type this command to create a first project composer create-project laravel/laravel first-project --prefer-dist Replace first-project with your project name (it takes a few minutes to install) 然后只需输入此命令即可创建第一个项目作曲家create-project laravel / laravel first-project --prefer-dist 将第一个项目替换为您的项目名称 (安装需要几分钟)
  4. 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 ) 然后重定向到localhost / laravel / first-project / public /现在你可以看到Laravel徽标以及一条快速消息“你已经到达。”(总是使用公共文件夹来访问项目)

Few steps to install for Windows Xampp, 为Windows Xampp安装的步骤很少,

  1. Download Composer here http://getcomposer.org/ 在这里下载Composer http://getcomposer.org/
  2. Download master copy here https://github.com/laravel/laravel/archive/master.zip 在此下载主副本https://github.com/laravel/laravel/archive/master.zip
  3. Paste the master in xampp/htdocs/your-project-name/[paste the master copy of laravel here] 将主文件粘贴到xampp / htdocs / your-project-name / [粘贴laravel的主副本]
  4. Go to Command prompt : Start Menu -> Run -> Type cmd or command or Window Key + R and type cmd or command. 转到命令提示符:开始菜单 - >运行 - >键入cmd或命令或窗口键+ R并键入cmd或命令。
  5. Go the path xampp/htdocs/your-project-name/ in command prompt and type composer install. 在命令提示符中输入路径xampp / htdocs / your-project-name /,然后键入composer install。
  6. It will automatically download the necessary files. 它会自动下载必要的文件。

Hope this will help. 希望这会有所帮助。

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. 或者只需按照以下步骤操作:强制作曲家使用https连接到Packagist从公司防火墙后面的作曲家遇到问题。 The firewall was blocking us from accessing a particular package.json file from the http://packagist.org website 防火墙阻止我们从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:// connections完全访问。

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. 我在阅读composer github网站上的文档时意识到你可以禁用默认的packagist配置。 In addition, of course you can add your own repositories to the composer.json in your project. 此外,您当然可以将自己的存储库添加到项目中的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. 希望这会有所帮助。

In my case in installed laravel 5.2 with php 7 在我的情况下安装laravel 5.2与PHP 7

Very Simple: 非常简单:

If you have working XAMPP on your machine with latest php version 如果你在你的机器上使用最新的php版本工作XAMPP

  1. Download the Composer from official site 从官方网站下载Composer

https://getcomposer.org/ https://getcomposer.org/

install by following simple steps. 按照以下简单步骤安装。

  1. To verify the installation Open Command Prompt (Window + R key and type cmd ) then type 要验证安装,请打开命令提示符(Window + R键并键入cmd),然后键入

    composer 作曲家

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. 您将看到有关作曲家及其各自版本的详细信息。

  1. After successfully installing composer install laravel by just typing the command: Ensure your working Internet 只需输入命令即可成功安装composer install laravel: 确保您的Internet工作正常

    composer global require "laravel/installer" 作曲家全球需要“laravel / installer”

it will automatically download from their server and also his Dependencies. 它将自动从他们的服务器和他的依赖项下载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM