今天,我决定学习并任务自己在Symfony2中创建REST API。我已经使用这个命令安装了composer
curl -sS https://getcomposer.org/installer | php
现在我正在使用以下命令安装Voryx REST生成器捆绑包
php composer.phar require voryx/restgeneratorbundle dev-master
我收到这个错误
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of package
Problem 1
- Installation request for voryx/restgeneratorbundle dev-master -> s
le by voryx/restgeneratorbundle[dev-master].
- voryx/restgeneratorbundle dev-master requires sensio/generator-bun
-> satisfiable by sensio/generator-bundle[3.0.x-dev, v3.0.0, v3.0.1, v3
.0.3, v3.0.4, v3.0.5, v3.0.6] but these conflict with your requirements
um-stability
Installation failed, reverting ./composer.json to its original content.
这是捆绑的github存储库
https://github.com/voryx/restgeneratorbundle
==========编辑========这是composer.json文件
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The "Symfony Standard Edition" distribution",
"autoload": {
"psr-0": { "": "src/", "SymfonyStandard": "app/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.5.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0"
},
"require-dev": {
"sensio/generator-bundle": "~2.3"
},
"scripts": {
"post-root-package-install": [
"SymfonyStandard\Composer::hookRootPackageInstall"
],
"post-install-cmd": [
"Incenteev\ParameterHandler\ScriptHandler::buildParameters",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::removeSymfonyStandardFiles"
],
"post-update-cmd": [
"Incenteev\ParameterHandler\ScriptHandler::buildParameters",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile",
"Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::removeSymfonyStandardFiles"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.5-dev"
}
}
}
请问你做错了什么?
不要指定要安装的捆绑包(dev-master)的版本:只需将作业交给Composer即可启动命令:
php composer.phar require voryx/restgeneratorbundle
并将安装适合您当前依赖关系的版本(0.3.0)。
要安装sf3安装版本,请参阅此处的文档:目前存在各种安装方式。使用composer,您可以简单地运行命令:
php composer.phar create-project symfony/framework-standard-edition my_project_name
希望这能帮助