我有两个私有GitHub账户上的项目-一个是库,另一个是我的应用程序。
我想将我的库包含到我的应用程序中。
我的库的composer.json文件如下:
{
"name": "andyw/mylibrary",
"description": "My Library",
"license": "proprietary",
"homepage": "https://github.com/andyw/mylibrary",
"require": {
"php": ">=5.5.0",
"monolog/monolog": "1.*",
"guzzle/guzzle": "3.*",
"aws/aws-sdk-php": "2.*",
"nixilla/twitter-api-consumer": "*",
"webignition/robots-txt-file": "dev-master",
"webignition/robots-txt-parser": "dev-master",
"pusher/pusher-php-server": "*",
"symfony/validator": "2.*"
},
"require-dev": {
"phpunit/phpunit": "3.*"
},
"autoload": {
"psr-0": {
"": "src/"
}
}
}
在该项目中运行composer update
可以成功安装依赖项。到目前为止,一切都很顺利。
现在这是我的应用程序的composer.json文件:
{
"name": "andyw/myapp",
"type": "project",
"description": "My application",
"homepage": "https://github.com/andyw/myapplication",
"license": "proprietary",
"repositories": [
{
"type": "git",
"url": "git@github.com:andyw/myapplication.git"
}
],
"require": {
"php": ">=5.5.0",
"andyw/mylibrary": "dev-master",
"facebook/php-sdk-v4": "4.0.*",
"silex/silex": "~1.1",
"monolog/monolog": "~1.6",
"twig/twig": "~1.14",
"doctrine/dbal": "~2.4",
"nesbot/Carbon": "~1.6",
"aws/aws-sdk-php": "2.*",
"jms/serializer": "0.15",
"symfony/validator": "2.*",
"jdesrosiers/silex-cors-provider": "~0.1.2",
"swiftmailer/swiftmailer": ">=4.1.2,<4.2-dev",
"fzaninotto/faker": "~1.4"
},
"require-dev": {
"mockery/mockery": "~0.8.0"
},
"autoload": {
"psr-0": {
"App": "src/"
}
}
}
在该项目上运行
composer update
失败。添加--verbose
标志会输出以下内容:Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for andyw/mylibrary dev-master -> satisfiable by andyw/mylibrary[dev-master].
- andyw/mylibrary dev-master requires webignition/robots-txt-file dev-master -> no matching package found.
如果我的库可以安装
webignition/robots-txt-file dev-master
,为什么它不能作为依赖项的依赖项安装?如何解决这个问题?提示:我的所有存储库都不是公开的,并且出于隐私原因我已更改了我的软件包/文件名称。
"minimum-stability": "dev"
标志并尝试。 - Hari K Tdev-master
。dev-master
始终被 Composer 视为开发版本。或者,您可以指定版本并下载。 - Hari K T"prefer-stable": true
。 - localheinz