wilkques/console

v2.1.1 2023-07-31 07:23 UTC

This package is auto-updated.

Last update: 2024-04-30 00:39:57 UTC


README

Latest Stable Version License

composer require wilkques/console

How to use

  1. Add PHP command file (path default ./Console)

    <?php
    
    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
        }
    }
  2. in terminal run vi artisan & Add PHP code

    require_once 'vendor/autoload.php';
    
    $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);  
  3. in terminal run php artisan do:something --debug=true