PHP code example of wilkques / console

1. Go to this page and download the library: Download wilkques/console 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/ */

    

wilkques / console example snippets


    

    use Wilkques\Console\Command;

    class DoSomethingCommand extends Command
    {
        /**
         * signature
         * 
         * @var string
         */
        public $signature = "do:something
                            {--debug=false: debug mode (default false)}
                            {--list=false: get list (default false)}";

        /**
         * description
         * 
         * @var string
         */
        public $description = "do something";

        /**
         * handle this command
         */
        public function handle()
        {
            // do something
        }
    }
    

      $command = $argv;

    array_shift($command);

    console()
    ->setCommandRootPath("<set console dir path>") // if you want change path
    ->setComposerPath("<composer.json path>") // if you want change
    ->build()
    ->handle($command);