robotstxt-documentation-mar.../vendor/eduardovillao/wp-since
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-01-30 18:51:40 +00:00
..
.github v1.0.0 2026-01-30 18:51:40 +00:00
bin v1.0.0 2026-01-30 18:51:40 +00:00
src v1.0.0 2026-01-30 18:51:40 +00:00
tests v1.0.0 2026-01-30 18:51:40 +00:00
.editorconfig v1.0.0 2026-01-30 18:51:40 +00:00
.gitignore v1.0.0 2026-01-30 18:51:40 +00:00
check-plugin.php v1.0.0 2026-01-30 18:51:40 +00:00
composer.json v1.0.0 2026-01-30 18:51:40 +00:00
composer.lock v1.0.0 2026-01-30 18:51:40 +00:00
generate-since-json.php v1.0.0 2026-01-30 18:51:40 +00:00
phpcs.xml v1.0.0 2026-01-30 18:51:40 +00:00
README.md v1.0.0 2026-01-30 18:51:40 +00:00
wp-since.json v1.0.0 2026-01-30 18:51:40 +00:00

WP Since

License Code Style: PSR-12 Tests

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 dont exist in declared minimum WP version?

wp-since helps you avoid those headaches by automatically analyzing your plugins code and checking compatibility against real WordPress versions.

Heres 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 @since tags
  • 🚨 Reports any used symbols that require a newer WP version than whats declared

Example Output

Lets 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 dont make it into your final plugin zip — like tests or dev tools? No worries — wp-since respects your ignore rules.

Supported ignore sources:

  • .distignore
  • .gitattributes with export-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 its 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 wont trigger ignores.

🛠️ Coming Soon

  • GitHub Action integration
  • HTML/Markdown reports
  • Export for CI/CD pipelines

📜 License

MIT © Eduardo Villão
Use freely, contribute gladly.