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

php的作曲家。phar更新

但我发现了一个错误:

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

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

php composer.phar install

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


当前回答

朋友们,请按照以下步骤在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

其他回答

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

你的作曲家。法尔应放在上述方式。

如果你已经安装了Composer,你可以试试这个命令:

composer update 

或者如果你想添加一些bundle到你的作曲家尝试这个:

composer require "/../"

在命令行中执行如下命令: curl -sS https://getcomposer.org/installer | php

只需以管理员身份打开cmd,进入您的项目文件夹,并使用composer命令检查它是否工作。

上述错误是由于编写器不能全局访问。 因此,您需要以管理员身份运行“cmd”。

这对我来说很有效。