PHPackages                             tictock/tictock - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tictock/tictock

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tictock/tictock
===============

An OS independent task scheduler

1.0.0(10y ago)1151[3 issues](https://github.com/phillipsdata/tictock/issues)[1 PRs](https://github.com/phillipsdata/tictock/pulls)MITPHPPHP &gt;=5.3

Since Dec 11Pushed 10y ago4 watchersCompare

[ Source](https://github.com/phillipsdata/tictock)[ Packagist](https://packagist.org/packages/tictock/tictock)[ RSS](/packages/tictock-tictock/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (3)Used By (0)

Tictock
=======

[](#tictock)

[![Build Status](https://camo.githubusercontent.com/411de98730edf7eb072caaebe73d7f6ceb31e03ec15114b9dceefa6974bfdccb/68747470733a2f2f7472617669732d63692e6f72672f7068696c6c697073646174612f746963746f636b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/phillipsdata/tictock)

An OS independent task scheduler.

Provides a fluent interface for scheduling commands to run at various intervals. Works on \*nix and Windows.

Basic Usage
-----------

[](#basic-usage)

Initialize Tictock with your command:

```
use Tictock\Tictock;

$cmd = 'the command you want to run';
$tictock = new Tictock($cmd);
```

Schedule your command:

```
$schedule = $tictock->schedule()
    ->every()
    ->minute()
    ->every()
    ->hour()
    ->every()
    ->dayOfTheMonth()
    ->every()
    ->month()
    ->every()
    ->dayOfTheWeek();
$tictock->save($schedule);
```

The above would schedule your command to execute every minute of every hour of every day. This is the default schedule. We could actually simplify this as:

```
$schedule = $tictock->schedule();
$tictock->save($schedule);
```

What if we only want to execute on Fridays at 1 AM?

```
$schedule = $tictock->schedule()
    ->only()
    ->daysOfTheWeek(array(5)) // 0 = Sun, 1 = Mon, ... 5 = Fri, 6 = Sat
    ->only()
    ->hours(array(1)); // 0 = 12 AM, 1 = 1 AM, ... 12 = 12 PM, ... 23 = 11 PM
$tictock->save($schedule);
```

Notice how we don't have to declare that we want it to run every month, or every day of the month. The scheduler will automatically run at every interval unless we tell it otherwise.

Suppose we wanted to run something every 5 minutes?

```
$schedule = $tictock->schedule()
    ->every()
    ->minutes(5);
$tictock->save($schedule);
```

This could also be written as:

```
$schedule = $tictock->schedule()
    ->only()
    ->minutes(array(0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55));
$tictock->save($schedule);
```

**Note:** Defining select hours or minutes to run is not supported by Windows. The smallest non-interval value supported by Windows is `daysofTheMonth()`.

### Explanation of Periods

[](#explanation-of-periods)

The `every()` method supports the following:

- `minute()` Every minute
- `minutes(int $n)` Every `$n`th minute (2 - 59)
- `hour()` Every hour
- `hours(int $n)` Every `$n`th hour (2 - 23)
- `dayOfTheMonth()` Every day of the month
- `daysOfTheMonth(int $n)` Every `$n`th day of the month (2 - 30)
- `month()` Every month
- `months(int $n)` Every `$n`th month (2 - 11)
- `dayOfTheWeek()` Every day of the week
- `daysOfTheWeek(int $n)` Every `$n`th day of the week

The `only()` method supports the following:

- `minutes(array $minutes)` Only these minutes (0 - 59)
- `hours(array $hours)` Only these hours (0 - 23)
    - `0` = 12 AM, ..., `23` = 11 PM
- `daysOfTheMonth(array $days)` Only these days of the month (1 - 31)
- `months(array $months)` Only these months (1 - 12)
    - `1` = Janurary
    - `2` = February
    - `3` = March
    - `4` = April
    - `5` = May
    - `6` = June
    - `7` = July
    - `8` = August
    - `9` = September
    - `10` = October
    - `11` = November
    - `12` = December
- `daysOfTheWeek(array $days)` Only these days of the week (0 - 6)
    - `0` = Sunday
    - `1` = Monday
    - `2` = Tuesday
    - `3` = Wednesday
    - `4` = Thursday
    - `5` = Friday
    - `6` = Saturday

Advanced Usage
--------------

[](#advanced-usage)

### Output

[](#output)

The result of the request is returned by `Tictock::save()`. If you need the actual output returned, you need explicitly declare the scheduler. This can be done using the built-in `ScheduleFactory` or by explicitly initializing the Scheduler you want.

```
use Tictock\Tictock;

$cmd = 'the command you want to run';
$tictock = new Tictock($cmd);

$scheduler = $tictock->scheduler();
$schedule = $tictock->schedule()
$result = $tictock->save($schedule, $scheduler);

print_r($scheduler->output());
```

### Extending Tictock

[](#extending-tictock)

Tictock is totally modular. Use your own Schedule or Scheduler to do crazy stuff, like create a recurring todo on some remote web service or program your sprinkler system.

```
class MySchedule implements \Tictock\Schedule\ScheduleInterface
{
    // ...
}
```

```
class MyScheduler implements \Tictock\Scheduler\SchedulerInterface
{
    // ...
}
```

```
use Tictock\Tictock;

$data = 'your data';
$tictock = new Tictock($data);

$schedule = new MySchedule();
$scheduler = new MyScheduler();

$tictock->save($schedule, $scheduler);
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3811d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7f87ae869d67f48673504d6cba1adcb8945a3ba8280798917e18b7c744009fc2?d=identicon)[clphillips](/maintainers/clphillips)

---

Top Contributors

[![clphillips](https://avatars.githubusercontent.com/u/682986?v=4)](https://github.com/clphillips "clphillips (20 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/tictock-tictock/health.svg)

```
[![Health](https://phpackages.com/badges/tictock-tictock/health.svg)](https://phpackages.com/packages/tictock-tictock)
```

###  Alternatives

[webfactor/laravel-generators

Laravel generators for quickly creating entities.

3011.1k](/packages/webfactor-laravel-generators)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
