定制 hgraca/composer-system-requirements-plugin 二次开发

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

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

hgraca/composer-system-requirements-plugin

Composer 安装命令:

composer require hgraca/composer-system-requirements-plugin

包简介

A composer plugin to manage system dependencies.

README 文档

README

build status coverage report

This is a composer plugin that will check for requirements at the OS level itself, for example checking if Bash is installed and at a version above 5.0.

How to use

Install and allow the plugin

composer require "hgraca/composer-system-requirements-plugin"
{
  "name": "hgraca/some-project",
  "type": "project",
  "require": {
    "hgraca/composer-system-requirements-plugin": "^1.0"
  },
  "config": {
    "allow-plugins": {
      "hgraca/composer-system-requirements-plugin": true
    }
  }
}

Configure the requirements

At the moment of this writing, there is only one built in requirement, bash, which is validated by the class in src/Package/RequirementValidator/BashRequirementValidator.php.

If/when more requirements validators are added, you can find them in the same location.

The system requirements can be configured as:

{
  "name": "hgraca/dummy-shell-project-1",
  "type": "project",
  "extra": {
    "hgraca/composer-system-requirements-plugin": {
      "require": {
        "bash": "^5.1"
      }
    }
  }
}

Create your own validators

Your validators need to implement the interface \Hgraca\ComposerSystemRequirementsPlugin\Package\RequirementValidator\RequirementValidatorInterface.

For an example, see src/Package/RequirementValidator/BashRequirementValidator.php.

Add your custom requirements validators

{
  "name": "hgraca/dummy-shell-project-1",
  "type": "project",
  "extra": {
    "hgraca/composer-system-requirements-plugin": {
      "require": {
        "bash": "^5.1"
      },
      "validators": [
        "MyVendor\\MyProject\\MyValidatorClass"
      ]
    }
  }
}

A working example

For a working example, please check tests/PluginTestPlayground.

Feel free to run any of the following:

export COMPOSER="composer_with_successful_root_requirement-run_on_shell.json" && composer -d tests/PluginTestPlayground/TestProject install
export COMPOSER="composer_with_failed_root_requirement-run_on_shell.json" && composer -d tests/PluginTestPlayground/TestProject install

How to run

Using local PHP (8.2):

  • Install the dependencies with composer install;
  • The tests can be run with composer test;
  • To list all custom scripts run composer run-script --list.

Using Docker:

  • Change PHP and xdebug configs in ./build;
  • Install the dependencies with docker compose -f ./build/docker-compose.yaml run app composer install;
  • The tests can be run with composer docker-test;
  • To list all custom scripts run docker compose -f ./build/docker-compose.yaml run app composer run-script --list.

Other commands

  • composer git-bundle: create a git bundle
  • git clone -b main composer-system-requirements-plugin.gitbundle composer-system-requirements-plugin: recreate the repository from the git bundle

Author

Herberto Graca

hgraca/composer-system-requirements-plugin 适用场景与选型建议

hgraca/composer-system-requirements-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 21 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 04 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「plugin」 「composer」 「system」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 hgraca/composer-system-requirements-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 hgraca/composer-system-requirements-plugin 我们能提供哪些服务?
定制开发 / 二次开发

基于 hgraca/composer-system-requirements-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-06