All Projects → micropackage → requirements

micropackage / requirements

Licence: GPL-3.0 License
Requirements checker for WordPress plugins

Programming Languages

PHP
23972 projects - #3 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to requirements

filesystem
Wrapper for WordPress' Filesystem for easier file manipulations
Stars: ✭ 19 (-48.65%)
Mutual labels:  composer-library, micropackage
block-loader
Automatic WordPress Gutenberg block loader based on template files
Stars: ✭ 21 (-43.24%)
Mutual labels:  composer-library, micropackage
cache
WordPress cache wrapper
Stars: ✭ 13 (-64.86%)
Mutual labels:  composer-library, micropackage
dochooks
WordPress hooks in method comments. Annotated hooks.
Stars: ✭ 33 (-10.81%)
Mutual labels:  composer-library, micropackage
flarum-ext-indonesian
Indonesian Language Pack for Flarum
Stars: ✭ 13 (-64.86%)
Mutual labels:  composer
php-mime-detector
Detect a file's mime type using magic numbers.
Stars: ✭ 20 (-45.95%)
Mutual labels:  composer
unit-converter
Convert standard units from one to another with this easy to use, lightweight package
Stars: ✭ 104 (+181.08%)
Mutual labels:  composer
database
Aplus Framework Database Library
Stars: ✭ 147 (+297.3%)
Mutual labels:  composer
alfred-packagist
Alfred workflow to search for PHP packages with Packagist
Stars: ✭ 21 (-43.24%)
Mutual labels:  composer
php-mvc
PHP MVC ⦿ Dockerized • Composer • RESTful API • Memcached • cron • WebSocket
Stars: ✭ 17 (-54.05%)
Mutual labels:  composer
RaccoonWP
Modern Architecture Stack and Starter Theme for WordPress
Stars: ✭ 17 (-54.05%)
Mutual labels:  composer
validation
Aplus Framework Validation Library
Stars: ✭ 99 (+167.57%)
Mutual labels:  composer
auth
JSON Web Token Authentication for Laravel
Stars: ✭ 12 (-67.57%)
Mutual labels:  composer
cli
Aplus Framework CLI Library
Stars: ✭ 104 (+181.08%)
Mutual labels:  composer
scheduler
Task Scheduler for Laravel applications. UI from scratch
Stars: ✭ 18 (-51.35%)
Mutual labels:  composer-library
awps-cli
Nifty Command Line Application to quickly setup a new AWPS theme in WordPress
Stars: ✭ 25 (-32.43%)
Mutual labels:  composer
REST-Api-with-Slim-PHP
REST API with PHP Slim Framework 3 and MySQL
Stars: ✭ 69 (+86.49%)
Mutual labels:  composer
laravel-dingtalk
✨基于laravel5.5开发的钉钉机器人、支持多个钉钉群
Stars: ✭ 18 (-51.35%)
Mutual labels:  composer
wp-translation-downloader
Composer plugin to download WordPress translations
Stars: ✭ 35 (-5.41%)
Mutual labels:  composer
apigee-client-php
Client library to make API calls to Apigee Edge Management API
Stars: ✭ 18 (-51.35%)
Mutual labels:  composer

Requirements

BracketSpace Micropackage Latest Stable Version PHP from Packagist Total Downloads License

Micropackage logo

🧬 About Requirements

This micropackage allows you to test environment requirements to run your plugin.

It can test:

  • PHP version
  • PHP Extensions
  • SSL state
  • WordPress version
  • Active plugins
  • Current theme
  • DocHooks support

But it's open for any other custom check.

💾 Installation

composer require micropackage/requirements

🕹 Usage

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 \Micropackage\Requirements\Requirements( 'My Test Plugin', array(
	'php'                => '7.0',
	'php_extensions'     => array( 'soap' ),
	'wp'                 => '5.3',
	'dochooks'           => true,
	'ssl'                => true,
	'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.

Advanced usage

You can also define your own custom checks.

class CustomCheck extends \Micropackage\Requirements\Abstracts\Checker {

	/**
	 * Checker name
	 *
	 * @var string
	 */
	protected $name = 'custom-check';

	/**
	 * Checks if the requirement is met
	 *
	 * @param  string $value Requirement.
	 * @return void
	 */
	public function check( $value ) {

		// Do your check here and if it fails, add the error.
		if ( 'something' === $value ) {
			$this->add_error( 'You need something!' );
		}

	}

}

$requirements = new \Micropackage\Requirements\Requirements( 'My Test Plugin', array(
	'custom-check' => 'something else',
) );

$requirements->register_checker( 'CustomCheck' );

$is_good = $requirements->satisfied();

📦 About the Micropackage project

Micropackages - as the name suggests - are micro packages with a tiny bit of reusable code, helpful particularly in WordPress development.

The aim is to have multiple packages which can be put together to create something bigger by defining only the structure.

Micropackages are maintained by BracketSpace.

📖 Changelog

See the changelog file.

📃 License

GNU General Public License (GPL) v3.0. See the LICENSE file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].