2017 © Pedro Peláez
 

library php-scheduler

Simple PHP task scheduler

image

pmill/php-scheduler

Simple PHP task scheduler

  • Friday, February 6, 2015
  • by pmill
  • Repository
  • 3 Watchers
  • 13 Stars
  • 4,120 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 3 Open issues
  • 6 Versions
  • 9 % Grown

The README.md

php-scheduler

Code Climate Test Coverage Downloads, (*1)

Introduction

This package contains a simple PHP cron task scheduler that helps you version control your cron jobs., (*2)

Requirements

This library package requires PHP 5.4 or later and a linux operating system., (*3)

Installation

Installing via Composer

The recommended way to install php-scheduler is through Composer., (*4)

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

Next, run the Composer command to install the latest version of php-scheduler:, (*5)

composer.phar require pmill/php-scheduler

After installing, you need to require Composer's autoloader:, (*6)

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):, (*7)

* * * * * 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)., (*8)

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), (*9)

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

0.1.4 (25/01/2018), (*10)

  • Removed nesbot/carbon dependency

0.1.3 (24/05/2015), (*11)

  • Added unit tests

0.1.2 (13/05/2015), (*12)

  • Fixed missing output bug

0.1.1 (06/02/2015), (*13)

  • Fixed incorrect paths

0.1.0 (06/02/2015), (*14)

  • First public release of php-scheduler

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

The Versions

06/02 2015

dev-master

9999999-dev https://github.com/pmill/php-scheduler

Simple PHP task scheduler

  Sources   Download

MIT

The Requires

 

The Development Requires

php task scheduler cron

06/02 2015

0.1.0

0.1.0.0 https://github.com/pmill/php-scheduler

Simple PHP task scheduler

  Sources   Download

MIT

The Requires

 

php task scheduler cron

06/02 2015

0.1.1

0.1.1.0 https://github.com/pmill/php-scheduler

Simple PHP task scheduler

  Sources   Download

MIT

The Requires

 

php task scheduler cron

06/02 2015

0.1.2

0.1.2.0 https://github.com/pmill/php-scheduler

Simple PHP task scheduler

  Sources   Download

MIT

The Requires

 

php task scheduler cron

06/02 2015

0.1.3

0.1.3.0 https://github.com/pmill/php-scheduler

Simple PHP task scheduler

  Sources   Download

MIT

The Requires

 

The Development Requires

php task scheduler cron

06/02 2015

v0.1.4

0.1.4.0 https://github.com/pmill/php-scheduler

Simple PHP task scheduler

  Sources   Download

MIT

The Requires

 

The Development Requires

php task scheduler cron