wilkques/console

v3.0.0 2024-09-25 07:12 UTC

This package is auto-updated.

Last update: 2024-10-25 07:17:07 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