src/WordPress/Plugin.php
protected function registerArtisanCommand()
  {
    if (!class_exists('WP_CLI')) {
      return false;
    }
      
    /**
     * Run Laravel Artisan for this plugin
     */
    \WP_CLI::add_command($this->getCLICommandName(), function() {
      $args = [];

      // rebuild args, because WP_CLI does stuff to it...
      if (!empty($_SERVER['argv'])) {
        $args = array_slice($_SERVER['argv'], 2);
        array_unshift($args, $_SERVER['argv'][0]);
      }

      $this->artisan->handle(
        new \Symfony\Component\Console\Input\ArgvInput($args),
        new \Symfony\Component\Console\Output\ConsoleOutput
      );
    });
  }
protected function registerArtisanCommand()
  {
    if (!class_exists('WP_CLI')) {
      return false;
    }
      
    /**
     * Run Laravel Artisan for this plugin
     */
    \WP_CLI::add_command($this->getCLICommandName(), function() {
      $args = [];

      // rebuild args, because WP_CLI does stuff to it...
      if (!empty($_SERVER['argv'])) {
        $args = array_slice($_SERVER['argv'], 2);
        array_unshift($args, $_SERVER['argv'][0]);
      }

      $this->artisan->handle(
        new \Symfony\Component\Console\Input\ArgvInput($args),
        new \Symfony\Component\Console\Output\ConsoleOutput
      );
    });
  }
protected function registerArtisanCommand ( ) { if ( ! class_exists ( 'WP_CLI' ) ) { return false ; } /**
     * Run Laravel Artisan for this plugin
     */ \ WP_CLI :: add_command ( $ this -> getCLICommandName ( ) , function ( ) { $ args = [ ] ; // rebuild args, because WP_CLI does stuff to it... if ( ! empty ( $ _SERVER [ 'argv' ] ) ) { $ args = array_slice ( $ _SERVER [ 'argv' ] , 2 ) ; array_unshift ( $ args , $ _SERVER [ 'argv' ] [ 0 ] ) ; } $ this -> artisan -> handle ( new \ Symfony \ Component \ Console \ Input \ ArgvInput ( $ args ) , new \ Symfony \ Component \ Console \ Output \ ConsoleOutput ) ; } ) ; }
Create a WP-CLI command for running Artisan.
Create a WP - CLI command for running Artisan .