abc/scheduler 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

abc/scheduler

Composer 安装命令:

composer require abc/scheduler

包简介

Library for to manage schedules for repeated execution of tasks

README 文档

README

A PHP library to process schedules base on CRON expressions.

Features:

  • Define schedules based on CRON expressions
  • Symfony Console Command to run scheduler
  • Simple integration by implementing two interfaces

Build Status

Note: This project is still experimental!

Installation

composer require abc/scheduler

Getting Started

  1. Define a schedule provider by implementing ProviderInterfacve.

    namespace Abc\Scheduler;
    
    interface ProviderInterface
    {
        /**
         * @return string The provider's name, used to bind a provider to processors
         */
        public function getName(): string;
    
        /**
         * @param int|null $limit
         * @param int|null $offset
         * @return ScheduleInterface[]
         */
        public function provideSchedules(int $limit = null, int $offset = null): array;
    
        public function save(ScheduleInterface $schedule): void;
    }
  2. Define a schedule processor by implementing ProcessorInterface.

    namespace Abc\Scheduler;
    
    /**
     * Process a schedule that is due.
     */
    interface ProcessorInterface
    {
        public function process(ScheduleInterface $schedule);
    }
  3. Bind Processor to Provider and initialize the ScheduleCommand

    use Abc\Scheduler\Scheduler;
    use Abc\Scheduler\Symfony\ScheduleCommand;
    
    $myProvider = new MyProvider();
    $myProcessor = new MyProcessor();
    
    $scheduler = new Scheduler();
    $scheduler->bind($myProvider, $myProcessor);
    
    $command = new ScheduleCommand($scheduler);
  4. Run the command

    bin/console abc:schedule

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-09-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固