eduardovillao/wp-since
最新稳定版本:v1.3.0
Composer 安装命令:
composer require eduardovillao/wp-since
包简介
Check WordPress plugin compatibility by analyzing used functions, classes, hooks and comparing against the minimum required WP version.
README 文档
README
Make sure your plugin works with the right WordPress version — automatically.
Scans your WordPress plugin to detect all used core symbols and validates them against their official @since versions for accurate compatibility checks.
✨ How It Works
Ever struggled to define the correct minimum WordPress version for your plugin?
Worried about accidentally using functions or APIs that don’t exist in declared minimum WP version?
wp-since helps you avoid those headaches by automatically analyzing your plugin’s code and checking compatibility against real WordPress versions.
Here’s what it does:
- 🧠 Scans your plugin for used:
- Functions
- Classes
- Class methods (static and instance)
- Action and filter hooks
- 📖 Reads the declared Requires at least: version from your
readme.txt - 🗂️ Compares those symbols with a version map built from WordPress core using
@sincetags - 🚨 Reports any used symbols that require a newer WP version than what’s declared
Example Output
Let’s say your plugin uses register_setting() (introduced in WP 5.5), but your readme.txt declares compatibility with WordPress 5.4:
🔍 Scanning plugin files...
✅ Found readme.txt → Minimum version declared: 5.4
🚨 Compatibility issues found:
┌──────────────────────┬──────────────────┐
│ Symbol │ Introduced in WP │
├──────────────────────┼──────────────────┤
│ register_setting │ 5.5.0 │
└──────────────────────┴──────────────────┘
📌 Suggested version required: 5.5.0
Now imagine your code is fully aligned with your declared version:
🔍 Scanning plugin files...
✅ Found readme.txt → Minimum version declared: 5.5
🎉 No compatibility issues found!
Simple. Powerful. Automatic.
Because your plugin deserves reliable compatibility.
🚀 Usage
Requirements
- PHP 7.4+
- Composer
🛠️ Install via Composer (recommended)
composer require --dev eduardovillao/wp-since
▶️ Run the compatibility check
./vendor/bin/wp-since check ./path-to-your-plugin
🧹 Ignore Files & Folders
By default, wp-since scans all .php files in your plugin directory.
But what about files that don’t make it into your final plugin zip — like tests or dev tools? No worries — wp-since respects your ignore rules.
Supported ignore sources:
.distignore.gitattributeswithexport-ignore
If any of those files are present, wp-since will automatically ignore the listed files or folders during analysis — just like svn export or plugin deployment.
Example: .gitattributes
/tests/ export-ignore /tools/debug.php export-ignore
Example: .distignore
/tests /tools/debug.php
These paths will be excluded from compatibility checks. This helps avoid false positives caused by test or development files.
📝 Inline Ignore
You can ignore specific lines from the scan by adding a special inline comment.
This is useful when you conditionally use a newer function but know it’s safe, like:
if (function_exists('wp_some_new_func')) { return wp_some_new_func(); // @wp-since ignore }
Only inline comments on the same line will be considered — comments above the line won’t trigger ignores.
🛠️ Coming Soon
- GitHub Action integration
- HTML/Markdown reports
- Export for CI/CD pipelines
📜 License
MIT © Eduardo Villão
Use freely, contribute gladly.
统计信息
- 总下载量: 1.88k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 77
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-08