Manage your crontab with some simple PHP commands.

Package info

github.com/sebastianfeldmann/crontab

pkg:composer/sebastianfeldmann/crontab

Fund package maintenance!

sebastianfeldmann

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 1

dev-master / 1.0.x-dev 2020-05-01 13:12 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT bdb78f3fcf3904b3a7c1283f7507203dca38f493

  • Sebastian Feldmann <sf.woop@sebastian-feldmann.info>

crontab

This package is auto-updated.

Last update: 2026-06-29 01:13:29 UTC


README

👁 Latest Stable Version
👁 Minimum PHP Version
👁 Downloads
👁 License
👁 Build Status
👁 Scrutinizer Code Quality
👁 Code Coverage

Features

Lists all cron jobs with a nice OO interface. Add jobs to your crontab.

Requirements

  • PHP >= 7.0
  • POSIX Shell with crontab command

Installation

Installing crontab via Composer.

 "require": {
 "sebastianfeldmann/crontab": "~1.0"
 }

Usage

Read crontab

$crontab = new SebastianFeldmann\Crontab\Operator();
foreach ($crontab->getJobs() as $job) {
 echo "Description: . PHP_EOL . implode(PHP_EOL, $job->getComments()) . PHP_EOL;
 echo "Schedule:" . PHP_EOL . $job->getSchedule() . PHP_EOL;
 echo "Command: " . PHP_EOL . $job->getCommand() . PHP_EOL;
}

Add job to crontab

$crontab = new SebastianFeldmann\Crontab\Operator();
$crontab->addJob(
 new SebastianFeldmann\Crontab\Job(
 '30 4 * * *',
 '/foo/bar/binary',
 ['Some foo bar binary execution']
 )
);

This will add the following lines to your crontab.

# Some foobar binary execution
30 4 * * * /foo/bar/binary

The crontab parser is looking for commands and their description in the lines above the command. The parser expects commands to NOT spread over multiple lines with \.

# Descriptoon for some command
10 23 * * * some command

# Next Command Description
# even more description for the next command
30 5 * * * next command