PHPackages                             michaels/mistletoe - 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. michaels/mistletoe

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

michaels/mistletoe
==================

Cron and Single Use Task Management for PHP.

v0.9.3(9y ago)1409MITPHPPHP ~5.5|~7.0

Since Apr 26Pushed 4y ago2 watchersCompare

[ Source](https://github.com/chrismichaels84/mistletoe)[ Packagist](https://packagist.org/packages/michaels/mistletoe)[ Docs](https://github.com/michaels/mistletoe)[ RSS](/packages/michaels-mistletoe/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (5)Versions (5)Used By (0)

- todo: Parse Annotated Classes
- Separate processes (configurable)
- Tests
- documentation, repository

Mistletoe (PHP Cron Tasks)
==========================

[](#mistletoe-php-cron-tasks)

[![Latest Version](https://camo.githubusercontent.com/2f8edaf0dca8d79d4d22a3ea219079ace69825cb7f275a860817f2259565ee44/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f63687269736d69636861656c7338342f6d6973746c65746f652e7376673f7374796c653d666c61742d737175617265)](https://github.com/chrismichaels84/mistletoe/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/a9b453d7d447fa068a1f345bb767a4ececc37338e36343d8bdbc4d942c92aa3b/68747470733a2f2f7472617669732d63692e6f72672f63687269736d69636861656c7338342f6d6973746c65746f652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/chrismichaels84/mistletoe)[![Code Coverage](https://camo.githubusercontent.com/6f21bbf055048662abad47993aebc75cc5d02fc492187289cf93cbdde5e950d0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f63687269736d69636861656c7338342f6d6973746c65746f652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/chrismichaels84/mistletoe/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/0da3a227078a904cb7652c6b27dd954e73854806bbf850ba85a7139274b8286b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f63687269736d69636861656c7338342f6d6973746c65746f652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/chrismichaels84/mistletoe/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/31db05c655de58f2bb59a77c40dfa39a544e3fd410c219ceddb80cf0a3d60ed6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d69636861656c732f6d6973746c65746f652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/michaels/mistletoe)

Because Task Management Should Feel Like Christmas...or at least not suck!

Mistletoe provides a super easy-to-use way to manage cron tasks for php. Simply use the human-readable, fluent builder to add tasks, point ONE cron task to the `mt` file, and watch the magic happen.

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

[](#basic-usage)

In mistletoe.php

```
$planner = (new Mistletoe\TaskPlanner())
    ->add(\Some\Namespace\UpdateWhatever::class)->always()
    ->add('SomeOtherClass')->daily()->at('00:30')
    ->add(new Mistletoe\Command('gulp clean')->daily()->at('1:00')->onProductionOnly()
    ->add(function(){ echo "do something"; })->every5Minutes();
```

In your crontasks, simply add `/path/to/bin/mt run:due` to execute how ever often you want.

### Includes Full Support For

[](#includes-full-support-for)

- Simplify ALL cronjobs into a single job
- Environment detection and limiting (only run certain tasks in production)
- Tasks may be console commands, classes, or callables
- Fluent cron schedule builder
- An included TaskRunner
- Easy to create custom task runners
- CLI application
- Fully extensible
- PSR and PHP The Right Way Compliant

Install
-------

[](#install)

You can use mistletoe in one of three ways:

### As a Phar (Best)

[](#as-a-phar-best)

You may download a ready-to-use version of Box as a Phar:

- Go to
- Download the `mt` under Downloads
- Put it somewhere you'll remember it and/or add it to your path!

### As a Global Composer Install (Better)

[](#as-a-global-composer-install-better)

This is probably the best way when you have other tools like phpunit and other tools installed in this way:

```
$ composer global require michaels/mistletoe --prefer-source
```

You *may* need to add composer's bin directory to your path.

### As a Composer Dependency (Advanced)

[](#as-a-composer-dependency-advanced)

You may also install Mistletoe as a dependency for your Composer managed project:

```
$ composer require chrismichaels84/mistletoe
```

(or)

```
{
    "require-dev": {
        "chrismichaels84/mistletoe": "~0.9"
    }
}
```

> Be aware that using this approach requires additional configuration steps to prevent Mistletoe's own dependencies from colliding with your project's dependencies.

Usage
-----

[](#usage)

### As a Command Line Tool

[](#as-a-command-line-tool)

The easiest way to get setup is to create a `mistletoe.php` file to hold your cron tasks. This file simply returns an instance of `Mistletoe\TaskPlanner` all configured and ready to go.

```
$planner = (new Mistletoe\TaskPlanner())
    ->add(\Some\Namespace\UpdateWhatever::class)->always()
    ->add('SomeOtherClass')->daily()->at('00:30')
    ->add(new Mistletoe\Command('gulp clean')->daily()->at('1:00')->onProductionOnly()
    ->add(function(){ echo "do something"; })->every5Minutes();
```

From there, you just use the cli commands. Mistletoe assumes the default `mistletoe.php` is in the current working directory. You may specify a relative or absolute path to any file that returns a TaskPlanner instance.

For example:

- `mt list:all` - assumes `mistletoe.php` is in this dir
- `mt list:all /full/path/to/file.php` - will use the full path
- `mt list:all ../to/file.php` - will use the relative path

#### Commands

[](#commands)

- `list:all` - Lists ALL the commands that are register with info about each
- `list:due` - Lists only the command that are due at that moment with info about each
- `run:due` - Runs whatever commands are due at that moment
- `run:all` - Will force run EVERY command registered
- `run:task Full/Class/Path` - Will run only that one task, due or not
- `help` - Shows this guide

#### Options

[](#options)

If you set the verbosity level to "verbose" or higher, it will print extra information.

```
mt list:all -v
```

See  for more information.

### Setting up the TaskPlanner

[](#setting-up-the-taskplanner)

The config file only need return an instance of TaskPlanner that has been configured. There are several methods that make setting it up easy. For more options, see `Mistletoe\TaskPlanner`.

*Note: All that's required is at least on `add()` method*

```
$planner = (new TaskPlanner())
    ->setTaskRunner(new CustomTaskRunner()) // Optional: Must implement Mistletoe\Contracts\TaskRunnerInterface
    ->setCurrentEnvironment('development') // Optional

    // Add a simple task to run every minute
    ->add('SomeClass')->always()

    // Add Tasks as Classes, Console Commands, or Callables
    ->add(SomeClass::class)->always()
    ->add(new Mistletoe\Command('curl http://google.com/')->always()
    ->add(function () { echo 'something' })->always()
    ->add(new CustomTask())->always() // implements RunnableInterface

    // Add Tasks in a Chain, also as class, command, or callable
    ->add(SomeClass::class)->always()->followedBy('SomeOtherClass')

    // Only run on certain environments
    ->add(SomeClass::class)->always()->onProductionOnly()
    ->add(SomeClass::class)->always()->onDevelopmentOnly()
    ->add(SomeClass::class)->always()->onEnvironment('SomethingCustom')

    // Give it a specific cron schedule
    ->add('SomeTask)->schedule('* 10 * 5 3')

    // Use the Fluent Builder to control scheduling
    ->add('SomeTask)->yearly()->onMonth(6)->onDay(16)
    ->add('SomeTask)->monthly()->onDay(21)
    ->add('SomeTask)->weekly()->onMonday()
    ->add('SomeTask')->daily()->at('1:00')
    ->add('SomeTask')->hourly()->atMinute(10)->andAtMinute(55)
    ->add('SomeTask)->every3Hours() // every{X}Hours()
    ->add('SomeTask)->every22Minutes()
    ->add('SomeTask)->daily()->atMidnight()j
    ->add('SomeTask)->daily()->atHour(7)->andAtHour(12)

    // And Mix and Match to your hearts content...
return $planner;
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email :author\_email instead of using the issue tracker.

Credits
-------

[](#credits)

- [Michael Wilson](http://github.com/chrismichaels84)
- Special Thanks to [FBS](http://wearefbs.com/)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor3

3 contributors hold 50%+ of commits

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

Every ~22 days

Total

2

Last Release

3330d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6737bd5ffc92de869a9c8bc96bee45c5e8b802393e9c7b8b0d55b951aef4166c?d=identicon)[chrismichaels84](/maintainers/chrismichaels84)

---

Top Contributors

[![philsturgeon](https://avatars.githubusercontent.com/u/67381?v=4)](https://github.com/philsturgeon "philsturgeon (31 commits)")[![electricjones](https://avatars.githubusercontent.com/u/5412413?v=4)](https://github.com/electricjones "electricjones (21 commits)")[![frankdejonge](https://avatars.githubusercontent.com/u/534693?v=4)](https://github.com/frankdejonge "frankdejonge (17 commits)")[![RobLoach](https://avatars.githubusercontent.com/u/25086?v=4)](https://github.com/RobLoach "RobLoach (7 commits)")[![bcrowe](https://avatars.githubusercontent.com/u/752603?v=4)](https://github.com/bcrowe "bcrowe (5 commits)")[![colinodell](https://avatars.githubusercontent.com/u/202034?v=4)](https://github.com/colinodell "colinodell (5 commits)")[![reinink](https://avatars.githubusercontent.com/u/882133?v=4)](https://github.com/reinink "reinink (5 commits)")[![EmanueleMinotto](https://avatars.githubusercontent.com/u/417201?v=4)](https://github.com/EmanueleMinotto "EmanueleMinotto (5 commits)")[![ravage84](https://avatars.githubusercontent.com/u/625761?v=4)](https://github.com/ravage84 "ravage84 (4 commits)")[![marcqualie](https://avatars.githubusercontent.com/u/101022?v=4)](https://github.com/marcqualie "marcqualie (4 commits)")[![browner12](https://avatars.githubusercontent.com/u/5232313?v=4)](https://github.com/browner12 "browner12 (3 commits)")[![hassankhan](https://avatars.githubusercontent.com/u/1781985?v=4)](https://github.com/hassankhan "hassankhan (3 commits)")[![alexbilbie](https://avatars.githubusercontent.com/u/77991?v=4)](https://github.com/alexbilbie "alexbilbie (2 commits)")[![barryvdh](https://avatars.githubusercontent.com/u/973269?v=4)](https://github.com/barryvdh "barryvdh (2 commits)")[![kdubuc](https://avatars.githubusercontent.com/u/895661?v=4)](https://github.com/kdubuc "kdubuc (2 commits)")[![assertchris](https://avatars.githubusercontent.com/u/200609?v=4)](https://github.com/assertchris "assertchris (2 commits)")[![mAAdhaTTah](https://avatars.githubusercontent.com/u/4371429?v=4)](https://github.com/mAAdhaTTah "mAAdhaTTah (2 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")[![Anahkiasen](https://avatars.githubusercontent.com/u/1321596?v=4)](https://github.com/Anahkiasen "Anahkiasen (1 commits)")[![bencorlett](https://avatars.githubusercontent.com/u/181919?v=4)](https://github.com/bencorlett "bencorlett (1 commits)")

---

Tags

cronTasks

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

101466.4k45](/packages/friendsoftypo3-content-blocks)[phel-lang/phel-lang

Phel is a functional programming language that compiles to PHP

5155.1k17](/packages/phel-lang-phel-lang)

PHPackages © 2026

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