gpt4 book ai didi

composer-php - 如何从 packagist 安装 Satis 包依赖项

转载 作者:行者123 更新时间:2023-12-04 04:08:23 25 4
gpt4 key购买 nike

我已经在自己的服务器上成功设置了 Satis,并且能够从中提取包。

但是,这些私有(private)包中所需的依赖项不断地以其最新版本而不是指定的版本限制进行克隆。我认为 Satis 正在创建最新开发版本的本地镜像。但是我不想有本地镜像,我只需要它们直接从 Packagist 安装。

那么我需要如何设置项目/包/Satis 才能从 Packagist 安装那些私有(private)包中的依赖项?

谢谢。


这是我的 Satis 构建文件:

{
"name": "Package Server",
"homepage": "http://packages.URL",
"repositories": [
{
"type": "vcs",
"url": "git@bitbucket.org:USERNAME/REPO.git",
"options": {
"ssh2": {
"username": "USERNAME",
"pubkey_file": "PUBFILE",
"privkey_file": "PRIVATEFILE"
}
}
}
],
"require-all": true
}

这是需要私有(private)包的项目的 composer.json 文件(包没有标记的发布):

{
"name": "Test Project",
"description": "",
"require": {
"php": ">=5.4.0",
"USERNAME/REPO": "*"
},
"repositories": [
{
"type": "composer",
"url": "http://packages.URL"
}
],
"minimum-stability": "dev"
}

这是私有(private)包的 composer.json:

{
"name": "USERNAME/RPO",
"description": "",
"require": {
"php": ">=5.4.0",
"illuminate/support": "5.0.*",
"vinkla/hashids": "~1.0"
},

"minimum-stability": "dev"
}

最佳答案

在您的 Satis 配置中,您定义了 "require-all": true。这是默认设置,并选择您定义的存储库中所有包的所有版本。

您可以尝试删除 "require-all": true 以支持 require 部分。这意味着 Satis 将只包含这些特定的包及其版本,如下所示:

"require": {
"company/packageA": "*",
"company/packageB": "1.2.3",
"company/packageC": "2.0.0"
}

这是在 Satis 上挑选包裹


So if I understand correctly I need to add the private packages that are available in the specified private repository in the require key and their own dependencies will then install from Packagist?

添加 require-dependencies - 这告诉 Satis 不仅要镜像“require”部分中指定的包,还要镜像它们的所有依赖项。

参见 https://getcomposer.org/doc/articles/handling-private-packages-with-satis.md#resolving-dependencies

Is it possible to have multiple packages resided in one defined repository or does every single package need their own repository url entry in Satis?

我认为在一个 "type": "vcs" 存储库中不可能有多个包。

使用 "type": "composer" 和克隆的 packagist,您可以存储多个 repos。想到http://drupal-composer.orghttp://packagist.drupal-composer.org/ .

{
"repositories": [
{ "type": "vcs", "url": "https://github.com/somewhere/packageA" },
{ "type": "composer", "url": "https://packagist.org" }
],
"require": {
"package/packageA": "somewhere-dev",
"phpunit/phpunit": "*"
},
"require-dependencies": true
}

关于composer-php - 如何从 packagist 安装 Satis 包依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29252623/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com