定制 onspli/composer-inject-repositories 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

onspli/composer-inject-repositories

最新稳定版本:v0.1.0

Composer 安装命令:

composer require onspli/composer-inject-repositories

包简介

Plugin loads repository definitions from external files and injects them to composer.json.

README 文档

README

This Composer plugin allows loading repository definitions from external files and injecting them to composer.json. Files with additional repositories can be stored locally or fetched from remote locations (http, git).

Usage

You have several composer packages stored in private Github repositories (and thus not available on public packagist.org repository), and you want to use the packages in several composer projects.

Install plugin globally.

composer global require onspli/composer-inject-repositories

Create file repos.json listing all the repositories you want to use (as described on https://getcomposer.org/doc/05-repositories.md)

{
    "repositories": [
        {
            "type": "git",
            "url": "git@github.com:onspli/private-package-1.git"
        },
        {
            "type": "git",
            "url": "git@github.com:onspli/private-package-2.git"
        },
        {
            "type": "git",
            "url": "git@github.com:onspli/private-package-3.git"
        }
    ]
}

Add extra option inject-repositories to composer.json of your project.

{
    "name": "onspli/project-using-private-repos",
    "type": "project",
    "extra": {
        "inject-repositories": [
            {
                "type": "local",
                "path": "/path/to/repos.json"
            },
            {
                "type": "remote",
                "url": "https://my-domain.cz/repos.json"
            },
            {
                "type": "git",
                "url": "git@github.com:onspli/private-repos.git",
                "file": "repos.json"
            }
        ]
    },
    "require": {
        "onspli/private-package-2": "dev-main"
    }
}

The plugin reads repos.json file and injects repositories to composer.json of the project, so during composer invocations it effectively looks like:

{
    "name": "onspli/project-using-private-repost",
    "type": "project",
    "require": {
        "onspli/private-package-2": "dev-main"
    },
    "repositories": [
        {
            "type": "git",
            "url": "git@github.com:onspli/private-package-1.git"
        },
        {
            "type": "git",
            "url": "git@github.com:onspli/private-package-2.git"
        },
        {
            "type": "git",
            "url": "git@github.com:onspli/private-package-3.git"
        }
    ]
}

Verbose mode

See what files and repositories are injected using composer verbose mode:

composer install --verbose

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-13