brace/command

Provides a cli brace command to access di context

Maintainers

Package info

github.com/brace-project/brace-command

Homepage

pkg:composer/brace/command

Statistics

Installs: 738

Dependents: 2

Suggesters: 0

Stars: 0

Open Issues: 0

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

This package is auto-updated.

Last update: 2026-03-10 19:42:20 UTC


README

Offers brace-command on command line

Example

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

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

Example

Add this to 10_di.php

$app->addModule(new CommandModule())

And create 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");

Run the Scheduler

brace scheduler