2016-04-07 28 views
1

今天,我决定学习并尝试在Symfony2中创建REST API。 我已经使用这个命令Symfony REST:voryx/restgeneratorbundle安装失败,将./composer.json恢复为其原始内容

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

现在,我使用这个命令

php composer.phar require voryx/restgeneratorbundle dev-master 

安装Voryx REST发生器管束安装作曲家,我收到此错误

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 

======== ======== EDITTED这 是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" 
     } 
    } 
} 

请什么做错了吗?

+0

你从composer.json文件启动或启动在初始为空目录的命令? – Matteo

+0

我在一个包含symfony项目的目录中启动了它,我用netbeans –

+0

创建了这个项目,所以问题是关于您当前配置的依赖关系。你可以发布你的composer.json文件吗? – Matteo

回答

2

不要指定捆(DEV-大师)的版本要安装:简单地让工作作曲家只需启动命令:

php composer.phar require voryx/restgeneratorbundle 

,并会安装合适的版本与您当前依赖(0.3.0)。

安装sf3安装版本请参考doc这里:目前存在多种安装方式。与作曲家你可以简单地运行命令:

php composer.phar create-project symfony/framework-standard-edition my_project_name 

希望这有助于

+0

我希望世界知道你是一个天才。谢谢 –

+0

hi @AndreaRobinson欢迎您! – Matteo