PHP code example of ssnepenthe / wp-requirements

1. Go to this page and download the library: Download ssnepenthe/wp-requirements library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ssnepenthe / wp-requirements example snippets


use WP_Requirements\Plugin_Checker;

$checker = new Plugin_Checker( 'My Awesome Plugin', __FILE__ );

// Verify that the Debug_Bar class exists - an indirect way of verifying that the Debug_Bar plugin is active.
$checker->class_exists( 'Debug_Bar' );

// Verify that the DOM extension is loaded.
$checker->extension_loaded( 'dom' );

// Verify that the cmb2_bootstrap() function exists - an indirect way of verifying that the CMB2 plugin is active.
$checker->function_exists( 'cmb2_bootstrap' );

// Verify that the server has PHP 5.4 or greater.
$checker->php_at_least( '5.4' );

// Verify that Hello Dolly is active.
// First parameter is plugin path relative to the plugin directory.
// Second parameter is plugin name used for label when 

use WP_Requirements\Plugin_Checker;

$checker = Plugin_Checker::make( 'My Awesome Plugin', __FILE__ )
    ->function_exists( 'cmb2_bootstrap' )
    ->php_at_least( '5.6' )
    ->wp_at_least( '4.7' );

if ( $checker->r logic is  take place outside of this file to minimize risk of errors when ethod hooks in to 'admin_notices' to inform the user which