PHP code example of alleyinteractive / wp-plugin-loader

1. Go to this page and download the library: Download alleyinteractive/wp-plugin-loader 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/ */

    

alleyinteractive / wp-plugin-loader example snippets


use Alley\WP\WP_Plugin_Loader;

new WP_Plugin_Loader( [
	'plugin/plugin.php',
	'plugin-name-without-file',
] );

use Alley\WP\WP_Plugin_Loader;

WP_Plugin_Loader::create()
	->add( 'plugin/plugin.php' )
	->add( [
		'plugin-name-without-file',
		'another-plugin',
	] )
	->load();

use Alley\WP\WP_Plugin_Loader;

WP_Plugin_Loader::create()
	->add( 'plugin/plugin.php' )
	->when( fn () => 'production' !== wp_get_environment_type(), 'logger' )
	->load();

use Alley\WP\WP_Plugin_Loader;

WP_Plugin_Loader::create()
	->add( 'plugin/plugin.php' )
	->when(
		condition: fn () => 'production' !== wp_get_environment_type(),
		plugin: 'logger',
	)
	->load();

use Alley\WP\WP_Plugin_Loader;

( new WP_Plugin_Loader( [ ... ] )->prevent_activations();

use Alley\WP\WP_Plugin_Loader;

new WP_Plugin_Loader( plugins: [ ... ], cache: true );

new WP_Plugin_Loader( plugins: [ ... ], cache: 'my-prefix' );