Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wearerequired/wp-requirements-check

Simple drop-in library for WordPress plugins to check for PHP and WordPress version requirements
https://github.com/wearerequired/wp-requirements-check

wordpress wordpress-plugin

Last synced: 3 days ago
JSON representation

Simple drop-in library for WordPress plugins to check for PHP and WordPress version requirements

Awesome Lists containing this project

README

        

# WP Requirements Check

Simple drop-in class to check minimum PHP and WordPress version requirements in your plugin.

## Usage

1. Run `composer require wearerequired/wp-requirements-check`
2. In your main plugin file, instantiate the class using something like this:

```php
$requirements_check = new WP_Requirements_Check( array(
'title' => 'My awesome plugin',
'php' => '7.0',
'wp' => '4.7',
'file' => __FILE__,
'i18n' => array(
/* translators: 1: plugin name. 2: minimum PHP version. */
'php' => __( '“%1$s” requires PHP %2$s or higher. Please upgrade.', 'my-plugin' ),
/* translators: 1: plugin name. 2: minimum WordPress version. */
'wp' => __( '“%1$s” requires WordPress %2$s or higher. Please upgrade.', 'my-plugin' ),
),
) );

if ( $requirements_check->passes() ) {
// Proceed.
}
```

## Credits

Thanks to Mark Jaquith for his [grunt-wp-plugin](https://github.com/markjaquith/grunt-wp-plugin) template which contains similar code.