如何从 packagist 安装 Satis 包依赖项
How to make Satis package dependencies install from packagist
我已经在自己的服务器上成功设置了 Satis,并且能够从中提取包。
但是,这些私有包中所需的依赖项不断地以其最新版本而不是指定的版本限制进行克隆。我认为 Satis 正在创建最新开发版本的本地镜像。但是我不想有本地镜像,我只需要他们直接从 Packagist 安装。
那么我需要如何设置项目/包/Satis 才能在从 Packagist 安装的那些私有包中获得依赖项?
谢谢。
这是我的 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
}
这是需要私有包的项目的 composer.json 文件(包没有标记发布):
{
"name": "Test Project",
"description": "",
"require": {
"php": ">=5.4.0",
"USERNAME/REPO": "*"
},
"repositories": [
{
"type": "composer",
"url": "http://packages.URL"
}
],
"minimum-stability": "dev"
}
这是私有包的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?
Add 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.org with http://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
}
我已经在自己的服务器上成功设置了 Satis,并且能够从中提取包。
但是,这些私有包中所需的依赖项不断地以其最新版本而不是指定的版本限制进行克隆。我认为 Satis 正在创建最新开发版本的本地镜像。但是我不想有本地镜像,我只需要他们直接从 Packagist 安装。
那么我需要如何设置项目/包/Satis 才能在从 Packagist 安装的那些私有包中获得依赖项?
谢谢。
这是我的 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
}
这是需要私有包的项目的 composer.json 文件(包没有标记发布):
{
"name": "Test Project",
"description": "",
"require": {
"php": ">=5.4.0",
"USERNAME/REPO": "*"
},
"repositories": [
{
"type": "composer",
"url": "http://packages.URL"
}
],
"minimum-stability": "dev"
}
这是私有包的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?
Add 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.org with http://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
}