wearerequired / wp-requirements-check
Simple requirements checking class
Installs: 11 442
Dependents: 2
Suggesters: 0
Security: 0
Stars: 13
Watchers: 4
Forks: 3
Open Issues: 0
This package is auto-updated.
Last update: 2024-11-12 04:54:57 UTC
README
Simple drop-in class to check minimum PHP and WordPress version requirements in your plugin.
Usage
- Run
composer require wearerequired/wp-requirements-check
- In your main plugin file, instantiate the class using something like this:
$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 template which contains similar code.