2013-05-31 150 views
33

我想让作曲家从这个项目下载下面的库,但是,它没有composer.json文件,所以我不确定这是否可能。如何让作曲家安装非作曲家包?

{ 
    "require" : { 
     "fguillot/picoFeed" : "*" 
    }, 
    "repositories": [ 
     { 
      "type": "vcs", 
      "url": "https://github.com/fguillot/picoFeed" 
     } 
    ] 
} 

错误:

[Composer\Repository\InvalidRepositoryException]
No valid composer.json was found in any branch or tag of https://github.com/fguillot/picoFeed , could not load a package from it.

回答

63

要包括你需要建立一个package repository非作曲家库。这将使你是这样的:

{ 
    "repositories": [ 
     { 
      "type": "package", 
      "package": { 
       "name": "fguillot/picoFeed", 
       "version": "dev-master", 
       "source": { 
        "url": "https://github.com/fguillot/picoFeed", 
        "type": "git", 
        "reference": "origin/master" 
       } 
      } 
     } 
    ], 
    "require": { 
     "fguillot/picoFeed": "dev-master" 
    } 
} 
+2

是否可以更改此“包”的安装程序路径? –

+0

您是否尝试更改软件包名称? – George

0

作为除了从@George答案,关于comment从@DavidOliver,这里是你如何应该能够更改包安装目标:

"repositories" : [ 
    { 
     "type" : "package", 
     "package" : { 
      "name" : "vend0r/p4ckage", 
      "version" : "dev-master", 
      "type" : "foo-library", 
      "dist" : { 
       "url" : "https://github.com/vend0r/p4ckage.git", 
       "type" : "vend0r/p4ckage" 
      }, 
      "source" : { 
       "url"  : "https://github.com/vend0r/p4ckage.git", 
       "type"  : "git", 
       "reference" : "origin/master" 
      } 
     } 
    } 
] 
... 
"extra" : { 
    "installer-paths" : { 
     "libraries/footype" : [ 
      "type:foo-library" 
     ], 
    } 
} 
... 
"require" : { 
    "vend0r/p4ckage" : "dev-master" 
} 
+0

我偶然发现了这个问题,看看如何将非composer存储库安装到自定义路径中;事实证明,只需要'composer/installers'就无法完成:http://stackoverflow.com/a/20442240/1065925。 在同一页面上还有一个使用'oomphinc/composer-installers-extender'的解决方案。 – kufeiko