artack / symfony-ohdear-command
为Oh Dear计划任务提供即用功能。
0.1.2
2023-02-10 08:15 UTC
Requires
- php: ^8.0
- symfony/console: ^6.0
- symfony/http-client: ^6.0
README
Oh Dear Symfony 抽象命令
由 artack 在瑞士苏黎世开发。
特性
- 为计划任务提供即用功能。包括
- 命令消耗的内存
- 命令运行时间
- 命令退出码
- 异常情况下的错误消息
安装
您可以通过 Composer 安装此颜色库。
$ composer require artack/symfony-ohdear-command
用法
创建一个扩展抽象 OhDearCommand
类的 Symfony 命令
class YourNewSymfonyCommand extends OhDearCommand
如果您通过 `` 方法配置了您的命令,请确保也运行了父方法。
protected function configure(): void { parent::configure(); # following your own configurations }
您需要使用 doExecute
而不是 execute
方法来实际实现您的命令。该方法的其他签名与 execute
方法相同。
protected function doExecute(InputInterface $input, OutputInterface $output): int {...}
现在您可以使用 --ohdear-uuid
选项和 Oh Dear 提供的 uuid 运行该命令。uuid 是 Oh Dear 显示的 "ping URL" 的一部分。