hgraca/composer-system-requirements-plugin
Composer 安装命令:
composer require hgraca/composer-system-requirements-plugin
包简介
A composer plugin to manage system dependencies.
README 文档
README
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 bundlegit clone -b main composer-system-requirements-plugin.gitbundle composer-system-requirements-plugin: recreate the repository from the git bundle
Author
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 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hgraca/composer-system-requirements-plugin 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
This composer plugin enables installation of GravityForms WordPress plugin and its addons.
A full-stack framework system built from Aura library packages.
Simple ASCII output of array data
Users reviews system
统计信息
- 总下载量: 21
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 8
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-04-06