PHPackages                             zenstruck/schedule-bundle - 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. [CLI &amp; Console](/categories/cli)
4. /
5. zenstruck/schedule-bundle

ActiveSymfony-bundle[CLI &amp; Console](/categories/cli)

zenstruck/schedule-bundle
=========================

Schedule Cron jobs (commands/callbacks/bash scripts) within your Symfony application.

v1.9.0(5mo ago)4041.0M—8.3%23[11 issues](https://github.com/zenstruck/schedule-bundle/issues)[2 PRs](https://github.com/zenstruck/schedule-bundle/pulls)2MITPHPPHP &gt;=8.1CI failing

Since May 7Pushed 3mo ago11 watchersCompare

[ Source](https://github.com/zenstruck/schedule-bundle)[ Packagist](https://packagist.org/packages/zenstruck/schedule-bundle)[ Docs](https://github.com/zenstruck/schedule-bundle)[ GitHub Sponsors](https://github.com/kbond)[ GitHub Sponsors](https://github.com/nikophil)[ RSS](/packages/zenstruck-schedule-bundle/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (10)Dependencies (18)Versions (19)Used By (2)

The ScheduleBundle
==================

[](#the-schedulebundle)

[![CI](https://github.com/zenstruck/schedule-bundle/actions/workflows/ci.yml/badge.svg)](https://github.com/zenstruck/schedule-bundle/actions/workflows/ci.yml)[![Code Coverage](https://camo.githubusercontent.com/37d32b7fd7e4d943e12b0354168af09db0d101a4a361c35eb597d56d27139166/68747470733a2f2f636f6465636f762e696f2f67682f7a656e73747275636b2f7363686564756c652d62756e646c652f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d535a4535344f38595354)](https://codecov.io/gh/zenstruck/schedule-bundle)[![Latest Version](https://camo.githubusercontent.com/beff12f5b7fb8a534acc1a99bc40472de393479ebda50db24e6569c164d3e054/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a656e73747275636b2f7363686564756c652d62756e646c652e737667)](https://packagist.org/packages/zenstruck/schedule-bundle)[![Total Downloads](https://camo.githubusercontent.com/d6d0a8bdf8c1a3c433beb8aa9d11b6aeae034b055738f124230364de6153d5c5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a656e73747275636b2f7363686564756c652d62756e646c652e737667)](https://packagist.org/packages/zenstruck/schedule-bundle)

Schedule Cron jobs (commands/callbacks/bash scripts) within your Symfony application. Most applications have jobs that need to run at specific intervals. This bundle enables you to define these jobs in your code. Job definitions (tasks) are version controlled like any other feature of your application. A single Cron entry (`php bin/console schedule:run`) on your server running every minute executes due tasks.

The inspiration and some of the API/code for this Bundle comes from [Laravel's Task Scheduling feature](https://laravel.com/docs/master/scheduling).

1. [Installation](#installation)
2. [Quick Start](#quick-start)
3. [Defining the Schedule](doc/define-schedule.md)
    1. [ScheduleBuilder Service](doc/define-schedule.md#schedulebuilder-service)
    2. [Your Kernel](doc/define-schedule.md#your-kernel)
    3. [Bundle Configuration](doc/define-schedule.md#bundle-configuration)
    4. [`AsScheduledTask` Attribute](doc/define-schedule.md#asscheduledtask-attribute)
    5. [Self-Scheduling Commands](doc/define-schedule.md#self-scheduling-commands)
    6. [Timezone](doc/define-schedule.md#timezone)
    7. [Schedule Extensions](doc/define-schedule.md#schedule-extensions)
        1. [Filters](doc/define-schedule.md#filters)
        2. [Callbacks](doc/define-schedule.md#callbacks)
        3. [Ping Webhook](doc/define-schedule.md#ping-webhook)
        4. [Email On Failure](doc/define-schedule.md#email-on-failure)
        5. [Notify On Failure](doc/define-schedule.md#notify-on-failure)
        6. [Run on Single Server](doc/define-schedule.md#run-on-single-server)
        7. [Limit to specific environment(s)](doc/define-schedule.md#limit-to-specific-environments)
4. [Defining Tasks](doc/define-tasks.md)
    1. [Task Types](doc/define-tasks.md#task-types)
        1. [CommandTask](doc/define-tasks.md#commandtask)
        2. [CallbackTask](doc/define-tasks.md#callbacktask)
        3. [ProcessTask](doc/define-tasks.md#processtask)
        4. [MessageTask](doc/define-tasks.md#messagetask)
        5. [PingTask](doc/define-tasks.md#pingtask)
        6. [CompoundTask](doc/define-tasks.md#compoundtask)
    2. [Task Description](doc/define-tasks.md#task-description)
    3. [Frequency](doc/define-tasks.md#frequency)
        1. [Cron Expression](doc/define-tasks.md#cron-expression)
        2. [Fluent Expression Builder](doc/define-tasks.md#fluent-expression-builder)
        3. [Hashed Cron Expression](doc/define-tasks.md#hashed-cron-expression)
    4. [Task ID](doc/define-tasks.md#task-id)
    5. [Timezone](doc/define-tasks.md#timezone)
    6. [Task Extensions](doc/define-tasks.md#task-extensions)
        1. [Filters](doc/define-tasks.md#filters)
        2. [Callbacks](doc/define-tasks.md#callbacks)
        3. [Ping Webhook](doc/define-tasks.md#ping-webhook)
        4. [Email Output](doc/define-tasks.md#email-output)
        5. [Notify Output](doc/define-tasks.md#notify-output)
        6. [Prevent Overlap](doc/define-tasks.md#prevent-overlap)
        7. [Run on Single Server](doc/define-tasks.md#run-on-single-server)
        8. [Between](doc/define-tasks.md#between)
5. [Running the Schedule](doc/run-schedule.md)
    1. [Cron Job on Server](doc/run-schedule.md#cron-job-on-server)
    2. [Symfony Cloud](doc/run-schedule.md#symfony-cloud)
    3. [Alternatives](doc/run-schedule.md#alternatives)
    4. [Force Run](doc/run-schedule.md#force-run)
    5. [Dealing with Failures](doc/run-schedule.md#dealing-with-failures)
    6. [Ensuring Schedule is Running](doc/run-schedule.md#ensuring-the-schedule-is-running)
    7. [Disable Schedule during Deploy](doc/run-schedule.md#disable-schedule-during-deploy)
6. [CLI Commands](doc/cli-commands.md)
    1. [schedule:list](doc/cli-commands.md#schedulelist)
    2. [schedule:run](doc/cli-commands.md#schedulerun)
7. [Extending](doc/extending.md)
    1. [Custom Tasks](doc/extending.md#custom-tasks)
    2. [Custom Extensions](doc/extending.md#custom-extensions)
    3. [Events](doc/extending.md#events)
8. [Full Configuration Reference](#full-configuration-reference)

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

[](#installation)

```
composer require zenstruck/schedule-bundle
```

*If not using Symfony Flex, be sure to enable the bundle.*

Quick Start
-----------

[](#quick-start)

1. Add your schedule service (assumes *autowire* and *autoconfiguration* enabled):

    ```
    // src/Schedule/AppScheduleBuilder.php

    namespace App\Schedule;

    use Zenstruck\ScheduleBundle\Schedule;
    use Zenstruck\ScheduleBundle\Schedule\ScheduleBuilder;

    class AppScheduleBuilder implements ScheduleBuilder
    {
        public function buildSchedule(Schedule $schedule): void
        {
            $schedule
                ->timezone('UTC')
                ->environments('prod')
            ;

            $schedule->addCommand('app:send-weekly-report --detailed')
                ->description('Send the weekly report to users.')
                ->sundays()
                ->at(1)
            ;

            // ...
        }
    }
    ```
2. List your tasks to diagnose any problems:

    ```
    php bin/console schedule:list
    ```
3. Add the following Cron job on your server running every minute:

    ```
    * * * * * cd /path-to-your-project && php bin/console schedule:run >> /dev/null 2>&1

    ```

See [Defining the Schedule](doc/define-schedule.md) and [Defining Tasks](doc/define-tasks.md)for more options.

Full Configuration Reference
----------------------------

[](#full-configuration-reference)

```
zenstruck_schedule:

    # The LockFactory service to use for the without overlapping extension
    without_overlapping_lock_factory: null # Example: lock.default.factory

    # The LockFactory service to use for the single server extension - be sure to use a "remote store" (https://symfony.com/doc/current/components/lock.html#remote-stores)
    single_server_lock_factory: null # Example: lock.redis.factory

    # The HttpClient service to use
    http_client:          null # Example: http_client

    # The default timezone for tasks (override at task level), null for system default
    timezone:             null # Example: America/New_York

    messenger:
        enabled:              false

        # The message bus to use
        message_bus:          message_bus

    mailer:
        enabled:              false

        # The mailer service to use
        service:              mailer

        # The default "from" email address (use if no mailer default from is configured)
        default_from:         null

        # The default "to" email address (can be overridden by extension)
        default_to:           null

        # The prefix to use for email subjects (use to distinguish between different application schedules)
        subject_prefix:       null # Example: "[Acme Inc Website]"

    notifier:
        enabled:              false

        # The notifier service to use
        service:              notifier

        # The default channel (can use a string, or array of channels)
        default_channel:      null

        # The default email address for email notifications
        default_email:        null

        # The default phone number for SMS notifications (can be overridden by extension)
        default_phone:        null

        # The prefix to use for notification subjects (use to distinguish between different application schedules)
        subject_prefix:       null # Example: "[Acme Inc Website]"

    schedule_extensions:

        # Set the environment(s) you only want the schedule to run in.
        environments:         [] # Example: [prod, staging]

        # Run schedule on only one server
        on_single_server:
            enabled:              false

            # Maximum expected lock duration in seconds
            ttl:                  3600

        # Send email if schedule fails (alternatively enable by passing a "to" email)
        email_on_failure:
            enabled:              false

            # Email address to send email to (leave blank to use "zenstruck_schedule.mailer.default_to")
            to:                   null

            # Email subject (leave blank to use extension default)
            subject:              null

        # Send notification if schedule fails (alternatively enable by passing a channel)
        notify_on_failure:
            enabled:              false

            # Channel to send notification to (leave blank to use "zenstruck_schedule.notifier.default_channel")
            channel:              null

            # Notification subject (leave blank to use extension default)
            subject:              null

            # Email address for email notifications  (leave blank to use extension default)
            email:                null

            # Phone number for SMS notifications (leave blank to use extension default)
            phone:                null

        # Ping a url before schedule runs (alternatively enable by passing a url)
        ping_before:
            enabled:              false

            # The url to ping
            url:                  ~ # Required

            # The HTTP method to use
            method:               GET

            # See HttpClientInterface::OPTIONS_DEFAULTS
            options:              []

        # Ping a url after schedule runs (alternatively enable by passing a url)
        ping_after:
            enabled:              false

            # The url to ping
            url:                  ~ # Required

            # The HTTP method to use
            method:               GET

            # See HttpClientInterface::OPTIONS_DEFAULTS
            options:              []

        # Ping a url if the schedule successfully ran (alternatively enable by passing a url)
        ping_on_success:
            enabled:              false

            # The url to ping
            url:                  ~ # Required

            # The HTTP method to use
            method:               GET

            # See HttpClientInterface::OPTIONS_DEFAULTS
            options:              []

        # Ping a url if the schedule failed (alternatively enable by passing a url)
        ping_on_failure:
            enabled:              false

            # The url to ping
            url:                  ~ # Required

            # The HTTP method to use
            method:               GET

            # See HttpClientInterface::OPTIONS_DEFAULTS
            options:              []
    tasks:

        # Example:
        -
            task:                send:sales-report --detailed
            frequency:           '0 * * * *'
            description:         Send sales report hourly
            without_overlapping: ~
            only_between:        9-17
            ping_on_success:     https://example.com/hourly-report-health-check
            email_on_failure:    sales@example.com
            notify_on_failure:   chat/slack

        # Prototype
        -

            # Defaults to CommandTask, prefix with "bash:" to create ProcessTask, prefix url with "ping:" to create PingTask, pass array of commands to create CompoundTask (optionally keyed by description)
            task:                 ~ # Required, Example: "my:command arg1 --option1=value", "bash:/bin/my-script" or "ping:https://example.com"

            # Cron expression
            frequency:            ~ # Required, Example: '0 * * * *'

            # Task description
            description:          null

            # The timezone for this task, null for system default
            timezone:             null # Example: America/New_York

            # Prevent task from running if still running from previous run
            without_overlapping:
                enabled:              false

                # Maximum expected lock duration in seconds
                ttl:                  86400

            # Only run between given times (alternatively enable by passing a range, ie "9:00-17:00"
            only_between:
                enabled:              false
                start:                ~ # Required, Example: 9:00
                end:                  ~ # Required, Example: 17:00

            # Skip when between given times (alternatively enable by passing a range, ie "17:00-06:00"
            unless_between:
                enabled:              false
                start:                ~ # Required, Example: 17:00
                end:                  ~ # Required, Example: 06:00

            # Ping a url before task runs (alternatively enable by passing a url)
            ping_before:
                enabled:              false

                # The url to ping
                url:                  ~ # Required

                # The HTTP method to use
                method:               GET

                # See HttpClientInterface::OPTIONS_DEFAULTS
                options:              []

            # Ping a url after task runs (alternatively enable by passing a url)
            ping_after:
                enabled:              false

                # The url to ping
                url:                  ~ # Required

                # The HTTP method to use
                method:               GET

                # See HttpClientInterface::OPTIONS_DEFAULTS
                options:              []

            # Ping a url if the task successfully ran (alternatively enable by passing a url)
            ping_on_success:
                enabled:              false

                # The url to ping
                url:                  ~ # Required

                # The HTTP method to use
                method:               GET

                # See HttpClientInterface::OPTIONS_DEFAULTS
                options:              []

            # Ping a url if the task failed (alternatively enable by passing a url)
            ping_on_failure:
                enabled:              false

                # The url to ping
                url:                  ~ # Required

                # The HTTP method to use
                method:               GET

                # See HttpClientInterface::OPTIONS_DEFAULTS
                options:              []

            # Send email after task runs (alternatively enable by passing a "to" email)
            email_after:
                enabled:              false

                # Email address to send email to (leave blank to use "zenstruck_schedule.mailer.default_to")
                to:                   null

                # Email subject (leave blank to use extension default)
                subject:              null

            # Send email if task fails (alternatively enable by passing a "to" email)
            email_on_failure:
                enabled:              false

                # Email address to send email to (leave blank to use "zenstruck_schedule.mailer.default_to")
                to:                   null

                # Email subject (leave blank to use extension default)
                subject:              null

            # Send notification after task runs (alternatively enable by passing a channel)
            notify_after:
                enabled:              false

                # Channel to send notification to (leave blank to use "zenstruck_schedule.notifier.default_channel")
                channel:              null

                # Notification subject (leave blank to use extension default)
                subject:              null

                # Email to send email notifications to (leave blank to use extension default)
                email:                null

                # Phone number for SMS notifications (leave blank to use extension default)
                phone:                null

            # Send email if task fails (alternatively enable by passing a "to" email)
            notify_on_failure:
                enabled:              false

                # Channel to send notification to (leave blank to use "zenstruck_schedule.notifier.default_channel")
                channel:              null

                # Notification subject (leave blank to use extension default)
                subject:              null

                # Email to send email notifications to (leave blank to use extension default)
                email:                null

                # Phone number for SMS notifications (leave blank to use extension default)
                phone:                null
```

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance77

Regular maintenance activity

Popularity58

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 93.9% 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 ~117 days

Recently: every ~246 days

Total

19

Last Release

92d ago

PHP version history (4 changes)v1.0.0PHP ^7.2

v1.1.0PHP &gt;=7.2

v1.6.0PHP &gt;=8.0

v1.9.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/707369cc916e0ea1aacbf077dcba464f611cef879f024d8944311a54a15224b3?d=identicon)[kbond](/maintainers/kbond)

---

Top Contributors

[![kbond](https://avatars.githubusercontent.com/u/127811?v=4)](https://github.com/kbond "kbond (232 commits)")[![bobvandevijver](https://avatars.githubusercontent.com/u/1835343?v=4)](https://github.com/bobvandevijver "bobvandevijver (3 commits)")[![tacman](https://avatars.githubusercontent.com/u/619585?v=4)](https://github.com/tacman "tacman (2 commits)")[![craigh](https://avatars.githubusercontent.com/u/350048?v=4)](https://github.com/craigh "craigh (1 commits)")[![encreinformatique](https://avatars.githubusercontent.com/u/22235605?v=4)](https://github.com/encreinformatique "encreinformatique (1 commits)")[![gassan](https://avatars.githubusercontent.com/u/2382015?v=4)](https://github.com/gassan "gassan (1 commits)")[![gisostallenberg](https://avatars.githubusercontent.com/u/11526270?v=4)](https://github.com/gisostallenberg "gisostallenberg (1 commits)")[![justrau](https://avatars.githubusercontent.com/u/10882793?v=4)](https://github.com/justrau "justrau (1 commits)")[![Chris53897](https://avatars.githubusercontent.com/u/7104259?v=4)](https://github.com/Chris53897 "Chris53897 (1 commits)")[![Lenny4](https://avatars.githubusercontent.com/u/25544892?v=4)](https://github.com/Lenny4 "Lenny4 (1 commits)")[![PhilETaylor](https://avatars.githubusercontent.com/u/400092?v=4)](https://github.com/PhilETaylor "PhilETaylor (1 commits)")[![pierredup](https://avatars.githubusercontent.com/u/144858?v=4)](https://github.com/pierredup "pierredup (1 commits)")[![bpastukh](https://avatars.githubusercontent.com/u/23012652?v=4)](https://github.com/bpastukh "bpastukh (1 commits)")

---

Tags

cronschedulesymfonysymfony-bundlecronschedule

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/zenstruck-schedule-bundle/health.svg)

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

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[crunzphp/crunz

Schedule your tasks right from the code.

2292.0M6](/packages/crunzphp-crunz)[shapecode/cron-bundle

This bundle provides scheduled execution of Symfony commands

59493.0k2](/packages/shapecode-cron-bundle)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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