yzh52521/webman-command

webman Framework, Laravel console artisan

v1.0.8 2023-08-14 01:05 UTC

This package is auto-updated.

Last update: 2024-11-14 03:35:32 UTC


README

安装

composer require yzh52521/webman-command

插件依赖

workerman/webman-framework
illuminate/console
illuminate/database
illuminate/events

命令扫描

默认自动扫描 app\command 下的命令(同 webman/console 的逻辑)

配置命令

config/command.php

自定义命令

return [
     \App\Commands\MyCommand::class,
];


#使用

新建命令

namespace app\command;

use Illuminate\Console\Command;

class Test extends Command
{
    protected $signature = 'test';

    protected $description = 'Test run command';

    public function handle(): void
    {
        $this->info("test!");
    }
}

调用 和laravel 使用一样

php artisan test 

业务中调用(比如控制器)

use \yzh52521\command\facade\Artisan;
Artisan::call('test');