publishpress/version-loader-generator
Composer 安装命令:
composer require publishpress/version-loader-generator
包简介
Composer script to generate the version loader files for libraries on PubilshPress
README 文档
README
Script to auto generate scripts and test for libraries on PublishPress.
The script will generate three files in the library:
lib/Versions.phplib/include.phptests/wpunit/VersionsCest.php
How to use
This library should be included in the target library as dev requirement:
composer require --dev publishpress/version-loader-generator
Once installed it will be available in the vendor/bin folder.
Its requires a few settings in the composer.json file to correctly generate the files:
{
"extra": {
"generator": {
"lib-class-test": "interface_exists('PublishPress\\Psr\\Container\\ContainerInterface')",
"action-initialize-priority": "-190",
"action-register-priority": "-200",
"version": "1.0.0"
}
}
}
lib-class-test: this is a fragment of PHP code that will check if the target library is loaded or not.action-register-priority: a negative integer that will be used as the priority of theplugins_loadedaction for registering the library. The registration should always be done before the initialization.action-intialize-priority: a negative integer that will be used as the priority of theplugins_loadedaction for initializing the library. The initialization should always be done before the plugin using the library is initialized.
We advise the plugins using the prefixed libraries to use the plugins_loaded action with a priority of -20 or higher to initialize the plugin instead of initializing it on run time.
Add a composer script to run the generator on every update/install. On the following example we are using Strauss also, to prefix the respective library:
{
"scripts": {
"strauss": [
"vendor/bin/strauss"
],
"generate-files": "vendor/bin/version-loader-generator",
"post-install-cmd": [
"@strauss",
"@generate-files"
],
"post-update-cmd": [
"@strauss",
"@generate-files"
]
}
}
How to test this script
vendor/bin/codecept run unit
How to test target libraries
Make sure Codeception is properly configured in the target library, for running WPUnit tests.
Add the following composer script to the composer.json file:
{
"scripts": {
"test": "vendor/bin/codecept run wpunit"
}
}
Then you can just run:
composer test
publishpress/version-loader-generator 适用场景与选型建议
publishpress/version-loader-generator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 444 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 04 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 publishpress/version-loader-generator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 publishpress/version-loader-generator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 444
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 18
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2023-04-20