pressmodo/wp-requirements

This package is abandoned and no longer maintained. No replacement package was suggested.

An helper library to determine requirements of WordPress plugins and themes.

1.0.3 2021-01-05 16:24 UTC

This package is auto-updated.

Last update: 2021-06-12 10:14:08 UTC


README

⚠️ Deprecated: please use https://github.com/alessandrotesoro/wp-diagnostics as replacement. ⚠️

WP Requirements

Simple drop-in library for WordPress plugins and themes to check for core, plugin, theme and php requirements.

Installation

composer require pressmodo/wp-requirements

Basic usage

In the plugin main file:

<?php
/*
Plugin Name: My Test Plugin
Version: 1.0.0
*/

// Composer autoload.
require_once __DIR__ . '/vendor/autoload.php' ;

$requirements = new \Pressmodo\Requirements\Requirements( 'My Test Plugin', array(
	'php'                => '7.0',
	'php_extensions'     => array( 'soap' ),
	'wp'                 => '5.3',
	'plugins'            => array(
		array( 'file' => 'akismet/akismet.php', 'name' => 'Akismet', 'version' => '3.0' ),
		array( 'file' => 'hello-dolly/hello.php', 'name' => 'Hello Dolly', 'version' => '1.5' )
	),
	'theme'              => array(
		'slug' => 'twentysixteen',
		'name' => 'Twenty Sixteen'
	),
) );

/**
 * Run all the checks and check if requirements has been satisfied.
 * If not - display the admin notice and exit from the file.
 */
if ( ! $requirements->satisfied() ) {
	$requirements->print_notice();
	return;
}

// ... plugin runtime.