我正在尝试在另一个项目中要求我自己的包,原始包在Bitbucket中托管并且有composer.json
:
{
"name": "example/swagger-client",
"description": "",
"keywords": [
"swagger",
"php",
"sdk",
"api"
],
"homepage": "http://swagger.io",
"license": "Apache v2",
"authors": [
{
"name": "Swagger and contributors",
"homepage": "https://github.com/swagger-api/swagger-codegen"
}
],
"require": {
"php": ">=5.3.3",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"satooshi/php-coveralls": "~0.6.1",
"squizlabs/php_codesniffer": "~2.0"
},
"autoload": {
"psr-4": { "Swagger\\Client\\" : "lib/" }
}
}
此软件包包含分支master
,develop
和release/release-1.0.0
。
使用此程序包的项目具有此composer.json
:
{
"name": "example/example-api-client",
"license": "proprietary",
"type": "symfony-bundle",
"description": "a description",
"keywords": ["Symfony", "bundle", "jwt", "jws", "authentication", "api", "rest"],
"repositories": [
{
"type": "git",
"url": "https://bitbucket.org/example/swaggerclient-example.git"
},
{
"type":"package",
"package":{
"name":"example/swagger-client",
"version": "dev",
"source":{
"type":"git",
"url":"https://bitbucket.org/example/swaggerclient-example.git",
"reference":"*"
}
}
}
],
"require": {
"php": ">=5.3.9",
"symfony/http-kernel": "2.8.*",
"symfony/security-bundle": "2.8.*",
"eightpoints/guzzle-bundle": "^5.3",
"example/swagger-client": "*"
},
"autoload": {
"psr-4": {
"ExampleOrg\\Bundle\\ExampleClientBundle\\": ""},
"exclude-from-classmap": [
"/Tests/"
]
},
"require-dev": {
"symfony/framework-bundle": "2.8.*",
"symfony/yaml": "2.8.*",
"phpunit/phpunit": "^4.8",
"symfony/phpunit-bridge": "~2.7",
"symfony/browser-kit": "2.8.*"
},
"autoload-dev": {
"psr-4": {
"ExampleOrg\\Bundle\\ExampleClientBundle\\Tests\\": "tests"
}
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "dev"
}
当尝试要求包"example/swagger-client"
时,我收到错误:
[InvalidArgumentException]
无法在任何版本中找到最近的包示例/ swaggerclient- 稳定性(稳定)。检查包装拼写或最小稳定性
此外,此版本的命令falis:php composer.phar require example/swaggerclient=dev
首先,我如何知道存储库是不可访问的还是可访问的,但其版本或其Composer文件是否存在问题?
其次,我该如何解决这个问题?
答案 0 :(得分:4)
我认为repositories
部分中存在太多内容。
这应该是你所需要的:
{
"require": {
"vendor/my-private-repo": "dev-master"
},
"repositories": [
{
"type": "vcs",
"url": "git@bitbucket.org:vendor/my-private-repo.git"
}
]
}
答案 1 :(得分:2)
(代表OP发布)。
除了简化@Peh所说的包部分外,我必须指定dev-develop
版本而不是*
,如下所示:"example/swagger-client": "dev-develop"
。