我是symfony2和symblog的新手。在第三章中,当我尝试使用数据fixture时,我尝试了命令:

php的作曲家。phar更新

但我发现了一个错误:

无法打开输入文件:composer.phar

所以我谷歌了一下,试了试

php composer.phar install

但还是得到相同的错误。因此,请指导如何使用wamp在symfony2中安装新的扩展或数据fixture之类的编写器。


当前回答

分两步。

curl -sS https://getcomposer.org/installer | php

Sudo PHP编写器。phar更新

其他回答

最简单直接的方法就是 -使用CD命令提示符导航到我的项目文件夹 -在CDM内输入composer以确保其已安装 -如果是,然后输入composer require ../你打算安装的扩展

如果你按照下面的指示去做:

https://getcomposer.org/doc/00-intro.md

它告诉你做以下事情:

$ curl -sS https://getcomposer.org/installer | php
$ mv composer.phar /usr/local/bin/composer

那么,很可能您和我一样,运行了这些命令,而没有阅读页面的下一部分,告诉您停止引用composer。Phar的全名和缩写为可执行文件(您刚刚用mv命令重命名了它)。所以这个:

$ php composer.phar update friendsofsymfony/elastica-bundle

变成这样:

$ composer update friendsofsymfony/elastica-bundle

你可以这样做

curl -sS https://getcomposer.org/installer | php

-sS标志表示不显示进度,只显示错误

然后

php composer.phar install

来自: 如何让cURL不显示进度条?

https://packagist.org/

对于Windows:)

composer update
composer self-update 

你被要求获得用户许可

还有一个命令:

composer require that_extention_you_want 

(而不是第一个:PHP composer。phar that_extention_you_want)

朋友们,请按照以下步骤在MAC OS中修复此问题

Step 1: first run the command in Terminal with your project directory $ curl -sS https://getcomposer.org/installer | php Step 2: Move the composer.phar in your project directory $ mv composer.phar /Applications/MAMP/htdocs/bashrushAPI/composer.phar Step 3: Setup alias the composer $ alias composer='/Applications/MAMP/htdocs/bashrushAPI/composer.phar' Step 4: Check the composer version now $ composer --version Composer version 1.7.2 2018-08-16 16:57:12 Step 5: Confirm the project folders and file placed on bellow $ ls CONTRIBUTING.md docker-compose.yml templates README.md logs tests composer.json phpunit.xml vendor composer.lock public composer.phar src Step 6: Now update composer $ composer.phar update Loading composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update Generating autoload files Step 7: Run your sample project $ php composer.phar start php -S localhost:8080 -t public [Thu Sep 27 03:16:11 2018] ::1:51177 [200]: / [Thu Sep 27 03:16:11 2018] ::1:51178 [404]: /favicon.ico - No such file or directory