PHPackages                             smichaelsen/php-cron-scheduler - 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. smichaelsen/php-cron-scheduler

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

smichaelsen/php-cron-scheduler
==============================

PHP Cron Job Scheduler

v1.1(10y ago)035MITPHPPHP &gt;=5.5.9

Since Jul 10Pushed 10y ago1 watchersCompare

[ Source](https://github.com/smichaelsen/php-cron-scheduler)[ Packagist](https://packagist.org/packages/smichaelsen/php-cron-scheduler)[ RSS](/packages/smichaelsen-php-cron-scheduler/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (3)Versions (7)Used By (0)

PHP Cron Scheduler
==================

[](#php-cron-scheduler)

[![Build Status](https://camo.githubusercontent.com/4cde870bded320b1489c4c0ac72d8b6a51942b1ad3c51acde691b2791f73385c/68747470733a2f2f7472617669732d63692e6f72672f70657070656f636368692f7068702d63726f6e2d7363686564756c65722e737667)](https://travis-ci.org/peppeocchi/php-cron-scheduler)[![Latest Stable Version](https://camo.githubusercontent.com/1a5536a9b50de5f442f6bae89b9264b3cfa033aef45b45ecb944ebcb18e326e7/68747470733a2f2f706f7365722e707567782e6f72672f70657070656f636368692f7068702d63726f6e2d7363686564756c65722f762f737461626c65)](https://packagist.org/packages/peppeocchi/php-cron-scheduler) [![Total Downloads](https://camo.githubusercontent.com/28be771f984ae0b00ba4218156fa317028f61a10312878a4c120ff4eeda93942/68747470733a2f2f706f7365722e707567782e6f72672f70657070656f636368692f7068702d63726f6e2d7363686564756c65722f646f776e6c6f616473)](https://packagist.org/packages/peppeocchi/php-cron-scheduler) [![Latest Unstable Version](https://camo.githubusercontent.com/72b65d8bd94197427e543081dc084e1164082270e0a35604e02ff80111cabfcf/68747470733a2f2f706f7365722e707567782e6f72672f70657070656f636368692f7068702d63726f6e2d7363686564756c65722f762f756e737461626c65)](https://packagist.org/packages/peppeocchi/php-cron-scheduler) [![License](https://camo.githubusercontent.com/2aff5507d09d06c71b3849f021fde96996980db908262b6de374ba4e6a634403/68747470733a2f2f706f7365722e707567782e6f72672f70657070656f636368692f7068702d63726f6e2d7363686564756c65722f6c6963656e7365)](https://packagist.org/packages/peppeocchi/php-cron-scheduler)

This is a simple cron jobs scheduler inspired by the [Laravel Task Scheduling](http://laravel.com/docs/5.1/scheduling).

Installing via Composer
-----------------------

[](#installing-via-composer)

The raccomended way is to install the php-cron-scheduler is through [Composer](https://getcomposer.org/).

Please refer to [Getting Started](https://getcomposer.org/doc/00-intro.md) on how to download and install Composer.

After you have downloaded/installed Composer, run

`php composer.phar require peppeocchi/php-cron-scheduler`

or add the package to your `composer.json`

```
{
    "require": {
        "peppeocchi/php-cron-scheduler": "1.*"
    }
}
```

How it works
------------

[](#how-it-works)

Instead of adding a new entry in the crontab for each cronjob you have to run, you can add only one cron job to your crontab and define the commands in your .php file.

By default when you schedule a command it will run in background, you can overwrite that behavior by calling `->runInForeground()` method.

```
$scheduler->call('myFunction')->runInForeground()->every()->minute();
```

**Jobs that should send the output to email/s are always set to run in foreground**

Create your `scheduler.php` file like this

```
