wearerequired/wp-requirements-check

Simple requirements checking class

1.1.0 2019-03-11 11:11 UTC

This package is auto-updated.

Last update: 2024-12-12 04:57:15 UTC


README

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:
$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.