How to use

The module is available for free installation through Composer on Packagist. Assuming you've added the Bootstrapper module to your project using Composer, your plugin's main file should look something like this:

<?php
/**
 * Plugin Name:       My Test Plugin
 * Version:           1.0.0
 * Requires at least: 5.7
 * Requires PHP:      8.0
 */
 
 // Load the Composer autoloader.
 \is_file( __DIR__ . '/vendor/autoload.php' ) && require_once __DIR__ . '/vendor/autoload.php';
 

 // Bootstrap the plugin (maybe)!
 if ( dws_wp_framework_check_php_wp_requirements_met( '8.0', '5.7' ) ) {
   // move ahead with plugin initialization
 } else {
   dws_wp_framework_output_requirements_error( 'My Test Plugin', '1.0.0', '8.0', '5.7', array( 'optional_argument' ) );
 }

The example above is very rudimentary. You can check our example plugin's bootstrap file for a more complete example.

Actions

The outputted admin notice can be customized using the following actions:

  • dws_wp_framework_requirements_error_before -- called before any HTML output of the notice

  • dws_wp_framework_requirements_error_start -- called right after the opening <div>

  • dws_wp_framework_requirements_error_list_before -- called right after the opening <ul>

  • dws_wp_framework_requirements_error_list_after -- called right before the closing </ul>

  • dws_wp_framework_requirements_error_end -- called right before the closing </div>

  • dws_wp_framework_requirements_error_after -- called after the entire HTML output of the notice

All actions receive the same arguments as the dws_wp_framework_output_requirements_error function. In order, those are:

  • The name of the component triggering the requirements error output.

  • The version of the said component.

  • The minimum PHP version required by said component.

  • The minimum WP version required by said component.

  • Any optional arguments passed on (array).

Last updated

Was this helpful?