brace/command

提供用于访问DI上下文的命令行brace命令

dev-main 2024-07-10 15:52 UTC

This package is auto-updated.

Last update: 2024-09-10 16:09:29 UTC


README

在命令行上提供 brace-command

示例

 $app->command->addCommand("analyze", function (array $arguments = []) {

    if ($arguments["--thread_id"] !== null) {
        
    }
    
}, "", [new CliValueArgument("--thread_id", "Thread ID to analyze")]);

示例

将以下内容添加到 10_di.php

$app->addModule(new CommandModule())

并创建 30_command.php

$app->command->addCommand("command1", function() {
    echo "Hello World";
});

// Execute command1 every 5 seconds
$app->command->addInterval(5, "command1");

// Support Cron format
$app->command->addInterval("* * * * *", "command1");

// Execut once per hour
$app->command->addInterval("5 * * * *", "command1");
$app->command->addInterval("5,10,15,20 * * * *", "command1");

运行调度器

brace scheduler