PHPackages                             elhardoum/wp-php-compat-check - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. elhardoum/wp-php-compat-check

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

elhardoum/wp-php-compat-check
=============================

Helps check PHP and WordPress compatibility before running the plugin.

0.2(8y ago)021GPL-3.0PHPPHP &gt;=5.0

Since Oct 24Pushed 8y ago1 watchersCompare

[ Source](https://github.com/elhardoum/wp-php-compat-check)[ Packagist](https://packagist.org/packages/elhardoum/wp-php-compat-check)[ RSS](/packages/elhardoum-wp-php-compat-check/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Compatibility Check helper for WordPress plugins
================================================

[](#compatibility-check-helper-for-wordpress-plugins)

Helps check PHP and WordPress compatibility before running the plugin.

You can wrap your main WordPress plugin code in this helper, and specify which minimum PHP version your plugin should run on, and also optionally which WordPress version to require as a minimum, and then the plugin should work with no fatal errors if all checks are met and the environment is compatible.

This helper requires PHP 5.0 at least, and should be working for multisite environments as well.

Usage:
------

[](#usage)

In your main plugin file, e.g `wp-content/plugins/my-plugin/my-plugin.php`, require this compat class:

```
require_once 'wp-php-compat-check/wp-php-compat-check.php';
```

*For composer users:*

```
composer require elhardoum/wp-php-compat-check
```

Then, make sure to copy all of your main file code (except the plugin header comments of course) into the `then` method:

```
CompatCheckWP::check(
    // ... arguments
)->then(function(){
    // [ ... ] Your plugin code goes here.
});
```

Here's an example:

```
