2012-07-14 58 views
2

如何通過作曲家將特定捆綁(例如SonataGoutteBundle)安裝到我的Symfony2項目Symfony2作曲家添加自己的捆綁要求

我試過這個,但它對我不起作用。任何想法有什麼不對?

"repositories": [ 
    { 
     "type": "package", 
     "package": { 
      "name": "sonata-project/sonatagouttebundle", 
      "version": "dev-master", 
      "dist": { 
       "url": "https://github.com/sonata-project/SonataGoutteBundle.git", 
       "type": "git" 
      } 
     } 
    } 
], 
"require": { 
    "php": ">=5.3.3", 
    [...], 
    "sonata-project/sonatagouttebundle": "dev-master" 
} 

回答

4

嘗試像

{ 
    "repositories": [ 
     { 
      "type": "vcs", 
      "url": "https://github.com/sonata-project/SonataGoutteBundle.git" 
     } 
    ], 

    "require": { 
     "php": ">=5.3.3", 
     "vendor/bundle": "dev-master" 
    } 
} 

的SonataGoutteBundle 必須有composer.json

在這種特殊情況下,這會工作:

"repositories": [ 
    { 
     "type": "package", 
     "package": { 
      "name": "sonata-project/goutte", 
      "version": "dev-master", 
      "source": { 
        "url": "https://github.com/sonata-project/SonataGoutteBundle.git", 
        "type": "git", 
        "reference": "master" 
       } 
     } 
    } 
], 
"require": { 
    "php": ">=5.3.3", 
    "sonata-project/goutte": "dev-master" 
} 

對於所有選項請參閱documentation

+0

的偉大工程,感謝 - 投票了! :) – F481 2012-07-14 21:34:51

3

您應該在「dist」部分提供一個指向檔案(如zip)的鏈接。如果你想使用git,你應該定義「源」節改爲:

{ 
    "repositories": [ 
     { 
      "type": "package", 
      "package": { 
       "name": "sonata-project/sonatagouttebundle", 
       "version": "dev-master", 
       "source": { 
        "url": "https://github.com/sonata-project/SonataGoutteBundle.git", 
        "type": "git", 
        "reference": "master" 
       } 
      } 
     } 
    ], 
    "require": { 
     "php": ">=5.3.3", 
     "sonata-project/sonatagouttebundle": "dev-master" 
    } 
} 

更多關於定義自定義庫:用於信息http://getcomposer.org/doc/04-schema.md#repositories

+0

有用的信息,謝謝! - 投票:) – F481 2012-07-14 21:34:18