pmill/php-scheduler 问题修复 & 功能扩展

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

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

pmill/php-scheduler

Composer 安装命令:

composer require pmill/php-scheduler

包简介

Simple PHP task scheduler

README 文档

README

Code Climate Test Coverage Downloads

Introduction

This package contains a simple PHP cron task scheduler that helps you version control your cron jobs.

Requirements

This library package requires PHP 5.4 or later and a linux operating system.

Installation

Installing via Composer

The recommended way to install php-scheduler is through Composer.

# Install Composer
curl -sS https://getcomposer.org/installer | php

Next, run the Composer command to install the latest version of php-scheduler:

composer.phar require pmill/php-scheduler

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

Once you've created your task list script (see Usage below) open a linux shell add the following line to crontab (crontab -e):

* * * * * php /path/to/your/task/list/script.php

Usage

The following example shows how to schedule a HelloDaily task (simple echo example) and a ShellMonday task (running a shell task example).

class HelloDailyTask extends \pmill\Scheduler\Task\Task
{
    public function run()
    {
        $this->setOutput('Hello World');
    }
}

class ShellMondayTask extends \pmill\Scheduler\Task\Shell
{
    protected $command = "echo Hello Monday";
}

$taskList = new \pmill\Scheduler\TaskList;

// Add task to run at 15:04 every day
$taskList->addTask((new HelloDailyTask)->setExpression('4 15 * * *'));

// Add task to run at 15:04 every Monday
$taskList->addTask((new ShellMondayTask)->setExpression('4 15 * * 1'));

$taskList->run();
$output = $taskList->getOutput();

Version History

0.1.5 (13/03/2019)

  • Resolve list of tasks due before running the tasks (thanks jhoughtelin)

0.1.4 (25/01/2018)

  • Removed nesbot/carbon dependency

0.1.3 (24/05/2015)

  • Added unit tests

0.1.2 (13/05/2015)

  • Fixed missing output bug

0.1.1 (06/02/2015)

  • Fixed incorrect paths

0.1.0 (06/02/2015)

  • First public release of php-scheduler

Copyright

php-scheduler Copyright (c) 2015 pmill (dev.pmill@gmail.com) All rights reserved.

统计信息

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

GitHub 信息

  • Stars: 17
  • Watchers: 3
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-02-06