Install Helpers Library as a dependency of your custom WordPress plugin. WARNING: This plugin relies on your plugin having a PHP namespace throughout all your PHP files including your main plugin file. This ensures that the library will be installed as a sub namespace. If you do not install this library properly, you will run into conflicts with other plugins using this dependency as well. 1. Download the latest version of Helpers Library from https://gitlab.com/sovdeveloping/helpers-library 2. Place the unzipped files in /wp-content/plugins/your-plugin/library/helpers-library 3. Add the PHP install code below into your main file in your plugin /wp-content/plugins/your-plugin-slug/your-plugin.php. 4. Replace "YourPlugin" with the name of your plugin, which is used as a namespace. Replace "YOURPLUGIN" with the name of your plugin in all caps as this is used for naming of PHP constants. Replace "your-plugin-slug" with the slug or name of the directory where all your plugins logic is. Replace "/load-your-plugin.php" with the path to the file where your plugin's logic starts (not the main file). 5. Now your plugin has PHP and WordPress compatibility checking installed. If the compatibility looks good, then it will installed the Helpers Library (if needed) and load it, then load your plugins functionality. When your installs the Helpers Library will automatically run install.php, it will copy the /library/helpers-library/ to /library/_helpers-library/ and automatically prepend all the namespaces with your custom namespace to prevent conflicts with other plugins. 6. The /library/_helpers-library/ directory is the files your plugin runs and the /library/helpers-library/ directory can be deleted once everything is running properly. true, 'timeout' => 15, 'redirection' => 0, 'user-agent' => __NAMESPACE__ . ' - ' . get_bloginfo( 'url' ), 'cookies' => $_COOKIE, 'sslverify' => apply_filters( 'https_local_ssl_verify', false ), 'body' => [ 'namespace' => __NAMESPACE__, 'plugin_dir' => __DIR__ ], ]; $response = wp_remote_post( plugin_dir_url( __FILE__ ) . '/library/helpers-library/install.php', $get_args ); if ( file_exists( $helpers_library_file ) ) { // Load Helper's Library include_once( $helpers_library_file ); } else { define( 'YOURPLUGIN_HELPERSLIBRARY_CONFLICT', YOURPLUGIN_NAME . ': Helpers Library not loaded (1)' ); } } else { define( 'YOURPLUGIN_HELPERSLIBRARY_CONFLICT', YOURPLUGIN_NAME . ': Helpers Library missing. Please reinstall the ' . YOURPLUGIN_NAME . ' plugin.' ); } } } else { define('YOURPLUGIN_HELPERSLIBRARY_CONFLICT', YOURPLUGIN_NAME . ': Helpers Library not loaded (2)'); } if ( defined( 'YOURPLUGIN_HELPERSLIBRARY_CONFLICT' ) ) { // Another plugin already loaded this library and there's a conflicting version define( 'YOURPLUGIN_COMPATIBLE_ERROR', YOURPLUGIN_HELPERSLIBRARY_CONFLICT ); } } } return ! defined( 'YOURPLUGIN_COMPATIBLE_ERROR' ); } /** * Displays the plugin compatibility error in the admin and network admin areas * * @package YourPlugin * @since 1.0.0 * * @return void */ function display_compatibility_notice() { echo '
' . esc_html( YOURPLUGIN_COMPATIBLE_ERROR ) . '