10up/wp-compat-validation-tool
最新稳定版本:0.3.1
Composer 安装命令:
composer require 10up/wp-compat-validation-tool
包简介
Perform PHP and WP version compatibility checks in your plugin.
README 文档
README
Perform PHP and WP version compatibility checks in your plugin.
Overview
This library provides API methods to perform version validation checks in WordPress plugins. Most helpful in situation where the plugin should gracefully exit on activation when system requirements aren't met.
Setup
In your project's composer.json, add the following:
{
"require": {
"10up/wp-compat-validation-tool": "dev-trunk"
},
"repositories": [
{
"type": "git",
"url": "https://github.com/10up/wp-compat-validation-tool.git"
}
],
"scripts": {
"post-install-cmd": [
"./10up-lib/wp-compat-validation-tool/replace-namespace.sh <New_Name_Space>"
],
"post-update-cmd": [
"./10up-lib/wp-compat-validation-tool/replace-namespace.sh <New_Name_Space>"
]
},
"extra": {
"installer-paths": {
"./{$name}/": ["10up/wp-compat-validation-tool"]
}
}
}
Replace <New_Name_Space> with a unique namespace specific to your project.
The WP_Compat_Validation_Tools namespace will be replaced by <New_Name_Space> to avoid namespace collisions in situations where multiple plugins use this package as their dependencies.
Usage
if ( ! is_readable( __DIR__ . '/10up-lib/wp-compat-validation-tool/src/Validator.php' ) ) { return; } require_once '10up-lib/wp-compat-validation-tool/src/Validator.php'; $compat_checker = new \New_Name_Space\Validator(); $compat_checker ->set_plugin_name( '<Your plugin name>' ) ->set_php_min_required_version( '7.4' ); if ( ! $compat_checker->is_plugin_compatible() ) { return; }
The Validator class should be instantiated before loading the vendor/autoload.php file, and the validation checks should be done before loading or instantiating any other composer dependency.
Support Level
Beta: This project is quite new and we're not sure what our ongoing support level for this will be. Bug reports, feature requests, questions, and pull requests are welcome. If you like this project please let us know, but be cautious using this in a Production environment!
Changelog
A complete listing of all notable changes to 10up Sitemaps is documented in CHANGELOG.md.
Contributing
Please read CODE_OF_CONDUCT.md for details on our code of conduct, CONTRIBUTING.md for details on the process for submitting pull requests to us, and CREDITS.md for a listing of maintainers of, contributors to, and libraries used by 10up Sitemaps.
Like what you see?
统计信息
- 总下载量: 97
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 2
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-22