承接 mkijak/cronjob-commands-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mkijak/cronjob-commands-bundle

最新稳定版本:v2.1

Composer 安装命令:

composer require mkijak/cronjob-commands-bundle

包简介

Runs (or not) registered Symfony commands according to cron expressions

README 文档

README

Using this bundle you can manage cron jobs with yaml configuration of your Symfony application.

It:

  • provides a simple way of running commands according to cron expressions
  • supports command arguments, options and verbosity settings
  • prints full output of running commands
  • uses https://github.com/dragonmantank/cron-expression to resolve cron expressions

Installing

Update composer.json:

composer require mkijak/cronjob-commands-bundle

Enable the bundle in Symfony application:

# config/bundles.php 

Mkijak\CronJobCommandsBundle\CronJobCommandsBundle::class => ['all' => true],

Configuration

It is recommended to set the timezone (default timezone is UTC and server settings aren't considered).

# config/packages/cron_job_commands.yaml
cron_job_commands:
    timezone: UTC
    schedule:
        command1:
            name: app:command #command name registered in symfony
            enabled: true #default: true
            cron_expression: "* * * * *" #supports also predefined keywords e. g. "@daily", see https://github.com/dragonmantank/cron-expression
            arguments:
                argument1name: value
                argument2name: value
            options:
                option1name: value
                option2name: value
            multivalue_options:
                option1name:
                    - value1
                    - value2
                option2name:
                    - value1
        command2:
            name: app:another_command
            cron_expression: "@daily"

Usage

Run the "trigger-command" once per minute. Consider using quiet mode for less output.

For cron: add to crontab (crontab -e):

* * * * * /path/to/symfony/bin/console cron_commands:trigger -q

In the quiet mode you can still display some messages from your commands setting visibility level as a second parameter of the writeln function (or 3rd parameter of the write function):

use Symfony\Component\Console\Output\OutputInterface;

/** @var OutputInterface $output */
$output->writeln('<error>Message</error>', OutputInterface::VERBOSITY_QUIET)

Requirements

  • PHP 8.0 or above
  • Symfony 5.0 or newer

Licence

Symfony commands as cron jobs is licenced under the MIT Licence.

统计信息

  • 总下载量: 1.54k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-04-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固