PHP code example of felixarntz / leavesandlove-wp-plugin-util

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

    

felixarntz / leavesandlove-wp-plugin-util example snippets



/*
Plugin Name: My Plugin
Plugin URI: https://wordpress.org/plugins/my-plugin/
Description: This is my plugin's description.
Version: 1.0.0
Author: John Doe
Author URI: http://example.com
License: GNU General Public License v3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Text Domain: my-plugin
*/

if ( version_compare( phpversion(), '5.3.0' ) >= 0 && ! class_exists( 'MyPluginNamespace\App' ) ) {
  // load the PHP autoloader...
  if ( file_exists( dirname( __FILE__ ) . '/my-plugin/vendor/autoload.php' ) ) {
    lseif ( file_exists( dirname( __FILE__ ) . '/vendor/felixarntz/leavesandlove-wp-plugin-util/leavesandlove-wp-plugin-loader.php' ) ) {
    


namespace MyPluginNamespace;

use LaL_WP_Plugin as Plugin;

if ( ! class_exists( 'MyPluginNamespace\App' ) ) {

  class App extends Plugin {
    protected static $_args = array();

    protected function __construct( $args ) {
      parent::__construct( $args );
    }

    protected function run() {
      // initialize the plugin here
    }
  }

}