Composer - 将本地 repo 设置为第一首选项
Composer - Set local repo as the first preference
我刚刚在我的 PC 上设置了一个本地存储库,并且运行良好。
但问题是当我安装一个包时,composer 工具首先检查 packagist 仓库而不是我的本地仓库。我想先检查本地回购协议。如何解决这个问题??。
这是我的全局 config.json
{
"repositories": {
"local": {
"type": "composer",
"url": "http://localhost:9090"
}
}
有什么帮助吗?
满意运行宁吗?
请浏览 http://localhost:9090 以确认。
Satis 需要 运行 正确并且必须列出您的包,然后才能使用 composer.json
(甚至将东西移至 config.json
)。
设置 Satis 的基本指南在这里:https://getcomposer.org/doc/articles/handling-private-packages-with-satis.md#satis。
如果你无法获得 Satis 运行ning,post 你的 satis.json
.
您可以尝试从 config.json
中删除密钥 local
并改为添加 "packagist": false
(以禁用 Packagist 查找)。
{
"repositories": [
{ "packagist": false },
{
"type": "composer",
"url": "http://localhost:9090"
}
]
}
我认为解决方案是结合
- 项目中的设置 "packagist":false
- 在您满意的配置上使用 "require-dependencies": true
。
这意味着您需要的所有包都不是由 Composer 直接从 Packagist(它关闭)获取的,而是通过 Satis 服务器间接获取的。
Satis 将联系 Packagist 并将包下载到您的 Satis space(本地包缓存),Composer 从那里抓取它们。
I cannot disable packagist since I need it for other packages.
当您允许 Satis 获取它们时,您可以为项目全局禁用 packagist。指令 require-dependencies
和 require-all
可能会有所帮助。
我刚刚在我的 PC 上设置了一个本地存储库,并且运行良好。
但问题是当我安装一个包时,composer 工具首先检查 packagist 仓库而不是我的本地仓库。我想先检查本地回购协议。如何解决这个问题??。
这是我的全局 config.json
{
"repositories": {
"local": {
"type": "composer",
"url": "http://localhost:9090"
}
}
有什么帮助吗?
满意运行宁吗?
请浏览 http://localhost:9090 以确认。
Satis 需要 运行 正确并且必须列出您的包,然后才能使用 composer.json
(甚至将东西移至 config.json
)。
设置 Satis 的基本指南在这里:https://getcomposer.org/doc/articles/handling-private-packages-with-satis.md#satis。
如果你无法获得 Satis 运行ning,post 你的 satis.json
.
您可以尝试从 config.json
中删除密钥 local
并改为添加 "packagist": false
(以禁用 Packagist 查找)。
{
"repositories": [
{ "packagist": false },
{
"type": "composer",
"url": "http://localhost:9090"
}
]
}
我认为解决方案是结合
- 项目中的设置 "packagist":false
- 在您满意的配置上使用 "require-dependencies": true
。
这意味着您需要的所有包都不是由 Composer 直接从 Packagist(它关闭)获取的,而是通过 Satis 服务器间接获取的。
Satis 将联系 Packagist 并将包下载到您的 Satis space(本地包缓存),Composer 从那里抓取它们。
I cannot disable packagist since I need it for other packages.
当您允许 Satis 获取它们时,您可以为项目全局禁用 packagist。指令 require-dependencies
和 require-all
可能会有所帮助。