题
到目前为止,我已经能够在 packagist 上发布我的包了。从我的存储库中, http://github.com/pbalan/directory-parser
当我尝试使用作曲家安装相同的程序时,我无法这样做。作曲家失败说:
Loading composer repositories with package information
Reading composer.json of pbalan/directory-parser (0.0.1)
Importing tag 0.0.1 (0.0.1.0)
Reading composer.json of pbalan/directory-parser (master)
Importing branch master (dev-master)
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package pbalan/directory-parser 1.0.0 could not be found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
这是我的 github 存储库中的作曲家:
{
"name" : "pbalan/directory-parser",
"description" : "DirectoryParser",
"license": "MIT",
"keywords" : ["DirectoryParser"],
"homepage" : "https://github.com/pbalan/directory-parser",
"authors" : [
{
"name" : "prashant"
}
],
"autoload" : {
"psr-0" : {"src" : ""}
},
"require" : {
"php": ">=5.3.3"
}
}
我正在尝试使用此composer.json 安装在一个新目录中:
{
"name" : "pbalan/directory-parser",
"description" : "DirectoryParser",
"license": "MIT",
"keywords" : ["DirectoryParser"],
"homepage" : "https://github.com/pbalan/directory-parser",
"authors" : [
{
"name" : "prashant"
}
],
"repositories": [
{
"type": "vcs",
"url": "http://github.com/pbalan/directory-parser.git"
}
],
"require" : {
"php": ">=5.3.3",
"pbalan/directory-parser": "dev-master"
}
}
我现在将composer.json更改为没有错误,但是我无法安装该包而只能安装自动加载器文件。
我怎样才能安装我的软件包?请帮忙!
解决方案
问题可能是您在第二个中重复使用包的名称 composer.json
.
只需使用它作为 composer.json
对于你的空目录:
{
"require": {
"php": ">=5.3.3",
"pbalan/directory-parser": "dev-master"
}
}
就这样!您不需要所有额外的信息,例如名称、描述等。除非您正在创建另一个在 Packagist 上也可用的库。
不隶属于 StackOverflow