>当我在我的自定义包中使用"作曲家需要 x/y"命令时,一切都完成了。完美获取所有依赖项。
但是当我尝试从 bitbucket 存储库添加到 laravel 项目时,只安装我的包而没有任何依赖项。
我将我的私人存储库设置为 laravel composer.json 文件
"repositories": {
"hooks": {
"type":"package",
"package": {
"name": "x/y",
"version":"1.0.2",
"source": {
"url": "https://{username}@bitbucket.org/x/y.git",
"type": "git",
"reference": "master"
}
}
}
}
我的自定义存储库作曲家.json
{
"name": "x/y",
"description": "Base Api System",
"license": "MIT",
"require": {
"php": "^7.2",
"tcg/voyager": "^1.1",
"predis/predis": "1.1",
"monarobase/country-list": "^2.0"
},
"require-dev": {
},
"autoload": {
"psr-4": {
"X\Y\": "src/"
}
},
"minimum-stability": "dev",
"extra": {
"laravel": {
"providers": [
"X\Y\XYServiceProvider"
]
}
}
}
作曲家需要输出
Using version ^1.0 for x/y
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing x/y (1.0.2): Cloning master from cache
Writing lock file
Generating optimized autoload files
> IlluminateFoundationComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: nunomaduro/collision
Package manifest generated successfully.
您错误地使用了package
类型。此类型适用于非作曲家包。作曲家甚至不会在这种依赖关系中查看composer.json
文件,因为它假定该文件不存在。有关包的所有相关信息都应在主(根(应用程序composer.json
repositories
设置中的包定义中。
但是在您的情况下,您拥有包含完整作曲家包(带有正确的composer.json
文件(的存储库,因此您应该vcs
或git
类型:
"repositories": [
{
"type":"git",
"url": "https://{username}@bitbucket.org/x/y.git"
}
]