PHPackages                             creatortsv/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. creatortsv/scheduler

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

creatortsv/scheduler
====================

Stand-alone package which provides functionality to schedule script execution

v1.0.1(2y ago)02.5kMITPHPPHP &gt;=8.1

Since Apr 12Pushed 2y ago1 watchersCompare

[ Source](https://github.com/creatortsv/scheduler)[ Packagist](https://packagist.org/packages/creatortsv/scheduler)[ RSS](/packages/creatortsv-scheduler/feed)WikiDiscussions main Synced 1mo ago

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

Scheduler
=========

[](#scheduler)

[![CI](https://github.com/creatortsv/scheduler/actions/workflows/php.yml/badge.svg?branch=main)](https://github.com/creatortsv/scheduler/actions/workflows/php.yml)

Stand-alone package which provides functionality to schedule script execution.

Installation
------------

[](#installation)

```
composer install creatortsv/scheduler
```

---

Getting Started
---------------

[](#getting-started)

It's easy to start using the scheduler.

```
use Creatortsv\Scheduler\Registrar\ScheduleRegistrar;
use Creatortsv\Scheduler\Scheduler;

$job = function (): void {
    /* your job logic here ... */
}

$scheduler = new Scheduler();
$scheduler->getRegistrar()->register($job);
$scheduler->run();
```

The example above just registered simple closure function as a job with default cron expression `* * * * *` (which means that it will be executed every minute) and run it.

Cron Expression
---------------

[](#cron-expression)

> For complete documentation of the Cron Expression object visit

Each job has its own cron expression object. The `register` method of the `ScheduleRegistrarInterface` returns a cron expression object with default value `* * * * *`. So you can change it after your job had been registered.

```
/* Initializing scheduler ... */

$expr = $scheduler->getRegistrar()->register($job);
$expr->setExpression('0 */2 * * *');

/* every two days at 00:00 */
```

Schedule Provider
-----------------

[](#schedule-provider)

Sometimes you want to register several jobs that could be grouped by specific logic. In that case Schedule Provider is more useful.

```
use Creatortsv\Scheduler\Provider\ScheduleProviderInterface;
use Creatortsv\Scheduler\Registrar\ScheduleRegistrarInterface;

class MyScheduleProvider implements ScheduleProviderInterface
{
    public function boot(ScheduleRegistrarInterface $registrar): void
    {
        // Register specific jobs here ...
    }
}
```

Don't forget to add your provider via scheduler object

```
/* Initializing scheduler ... */

$scheduler->add(new MyScheduleProvider());
```

Run Scheduler
-------------

[](#run-scheduler)

```
/* Initializing scheduler ... */

$scheduler->run();
```

By default, the Scheduler is running with the current `DateTime` object for each job, that means it will create the `DateTime` object and each Cron Expression object using the same timestamp determine if it is the time to execute job or not.

But sometimes you need run your schedule on the specific timestamp, testing for example. Use `Scheduler::at` method to change default behaviour.

```
/* Initializing scheduler ... */

$date = new DateTime();
$date->modify('-3 days');

$scheduler->at($date)->run();
```

---

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

[](#advanced-usage)

Sometimes you may want to control which jobs must be executed in addition of default behaviour. Only one instance of the registered job should be running at the current time, for example.

In that cases you can use `Scheduler::boot` method instead of `Scheduler::run`. The `boot` method returns `ScheduleIterator` object, each item is a job instance which must be executed by the given timestamp and each key is cron expression of given job.

Let's imagine that you have some service which determines that job is already being executed

```
class JobManager
{
    public function isReleased(SpecificJobInterface $job): bool
    {
        /* your logic is here ... */
    }
}
```

So you can use this service

```
/* Initializing $scheduler and your $jobManager ... */

foreach ($scheduler->boot() as $job) {
    if ($job instanceof SpecificJobInterface) {
        $jobManager->isReleased($job) && $job();
    }
}
```

But there is the best way to do so

```
/* Initializing $scheduler and your $jobManager ... */

$scheduler->getModerator()->register($jobManager->isReleased(...));
$scheduler->run();
```

And you shouldn't have to worry about if the job has different type of callable object

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.6% 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

Every ~163 days

Total

2

Last Release

969d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/aea9bfca7442b8c69aa5c1e877ae9fa1ece564d74a2881d41d311a496b743988?d=identicon)[creatortsv](/maintainers/creatortsv)

---

Top Contributors

[![creatortsv](https://avatars.githubusercontent.com/u/38066653?v=4)](https://github.com/creatortsv "creatortsv (7 commits)")[![tsaplin-v](https://avatars.githubusercontent.com/u/169811497?v=4)](https://github.com/tsaplin-v "tsaplin-v (4 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[peppeocchi/php-cron-scheduler

PHP Cron Job Scheduler

8282.5M34](/packages/peppeocchi-php-cron-scheduler)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[butschster/cron-expression-generator

Cron expression generator

511.4M2](/packages/butschster-cron-expression-generator)[elements/process-manager-bundle

The Process Manager allows you to manage (define,execute...) arbitrary processes/commands in the Pimcore backend.

49633.0k5](/packages/elements-process-manager-bundle)[pimcore/data-importer

Adds a comprehensive import functionality to Pimcore Datahub

44763.4k2](/packages/pimcore-data-importer)[rewieer/taskschedulerbundle

Task Scheduler with CRON for Symfony

63242.1k](/packages/rewieer-taskschedulerbundle)

PHPackages © 2026

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