2016-04-07 31 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