PHPackages                             ssnepenthe/wp-requirements - 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. ssnepenthe/wp-requirements

ActiveLibrary

ssnepenthe/wp-requirements
==========================

Helper for declaring dependencies in a WordPress plugin.

0.1.0(9y ago)41.3k25GPL-2.0PHPPHP &gt;=5.3

Since Apr 14Pushed 9y ago1 watchersCompare

[ Source](https://github.com/ssnepenthe/wp-requirements)[ Packagist](https://packagist.org/packages/ssnepenthe/wp-requirements)[ RSS](/packages/ssnepenthe-wp-requirements/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (5)

wp-requirements
===============

[](#wp-requirements)

Helper for declaring dependencies in a WordPress plugin.

Requirements
------------

[](#requirements)

WordPress, PHP 5.3 or later and Composer.

Installation
------------

[](#installation)

Install using Composer:

```
$ composer require ssnepenthe/wp-requirements

```

Usage
-----

[](#usage)

This package provides a simple method for ensuring that WordPress plugins fail gracefully down to PHP 5.3.

Create a checker instance in your main plugin file (e.g. `my-plugin/my-plugin.php`):

```
use WP_Requirements\Plugin_Checker;

$checker = new Plugin_Checker( 'My Awesome Plugin', __FILE__ );
```

Where the first parameter is the name of your plugin (used for notifications when requirements are not met) and the second parameter is the path to your main plugin file (used to deactivate the plugin).

Then add any number of requirements. All of the following are valid:

```
// Verify that the Debug_Bar class exists - an indirect way of verifying that the Debug_Bar plugin is active.
$checker->class_exists( 'Debug_Bar' );

// Verify that the DOM extension is loaded.
$checker->extension_loaded( 'dom' );

// Verify that the cmb2_bootstrap() function exists - an indirect way of verifying that the CMB2 plugin is active.
$checker->function_exists( 'cmb2_bootstrap' );

// Verify that the server has PHP 5.4 or greater.
$checker->php_at_least( '5.4' );

// Verify that Hello Dolly is active.
// First parameter is plugin path relative to the plugin directory.
// Second parameter is plugin name used for label when requirement is not met.
$checker->plugin_active( 'hello.php', 'Hello Dolly' );

// Verify that the server has WordPress 4.7 or greater.
$checker->wp_at_least( '4.7' );

// Check any arbitrary condition.
// First parameter is a closure that should return true when the requirement is met, false otherwise.
// Second parameter is a message to display when the requirement is not met. Note that it will be prefixed with '{plugin name} deactivated: ' when it is displayed.
$checker->add_check(
    function() {
        return defined( 'SOME_CONSTANT' ) && SOME_CONSTANT;
    },
    'SOME_CONSTANT must be defined and truthy'
);
```

The Plugin\_Checker class also provides a fluent interface:

```
use WP_Requirements\Plugin_Checker;

$checker = Plugin_Checker::make( 'My Awesome Plugin', __FILE__ )
    ->function_exists( 'cmb2_bootstrap' )
    ->php_at_least( '5.6' )
    ->wp_at_least( '4.7' );
```

Finally, verify all requirements are met and bootstrap your plugin accordingly.

```
if ( $checker->requirements_met() ) {
    // Whatever logic is required to bootstrap your plugin.
    // This should mostly take place outside of this file to minimize risk of errors when requirements are not met.
    $plugin = new My_Awesome_Plugin_Bootstrap;
    $plugin->init();
} else {
    // This method hooks in to 'admin_notices' to inform the user which requirements weren't met and 'admin_init' to actually deactivate the plugin.
    $checker->deactivate_and_notify();
}
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3314d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/acf42baca29dd8d1ffaf61009a3000068423a84db153c5cb864ef6fde64a1b87?d=identicon)[ssnepenthe](/maintainers/ssnepenthe)

---

Top Contributors

[![ssnepenthe](https://avatars.githubusercontent.com/u/10903810?v=4)](https://github.com/ssnepenthe "ssnepenthe (11 commits)")

---

Tags

phprequirementswordpresswordpress-php-library

### Embed Badge

![Health badge](/badges/ssnepenthe-wp-requirements/health.svg)

```
[![Health](https://phpackages.com/badges/ssnepenthe-wp-requirements/health.svg)](https://phpackages.com/packages/ssnepenthe-wp-requirements)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
