Skip to content

Kraddle/SchedulerBundle

 
 

Repository files navigation

Scheduler Bundle

A Symfony bundle built to schedule/consume tasks.

Main features

  • External transports (Doctrine, Redis, etc)
  • Retry / Remove tasks if failed
  • Can wait until tasks are dues
  • Messenger integration

Installation

Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.

$ composer require guikingone/scheduler-bundle

Quick start

Once installed, time to update the config/bundles.php:

// config/bundles.php

return [
    // ...
    SchedulerBundle\SchedulerBundle::class => ['all' => true],
];

Once done, just add a config/packages/scheduler.yaml:

# config/packages/scheduler.yaml
scheduler_bundle:
    transport:
        dsn: 'filesystem://first_in_first_out'

Once transport is configured, time to create a simple task:

# config/packages/scheduler.yaml
scheduler_bundle:
    transport:
        dsn: 'filesystem://first_in_first_out'
    tasks:
        foo:
            type: 'command'
            command: 'cache:clear'
            expression: '*/5 * * * *'
            description: 'A simple cache clear task'
            options:
              env: test

Once a task is configured, time to execute it, two approaches can be used:

  • Adding a cron entry * * * * * cd /path-to-your-project && php bin/console scheduler:consume >> /dev/null 2>&1
  • Launching the command scheduler:consume --wait in a background command

Documentation

For a full breakdown of each feature, please head to the documentation

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 99.1%
  • Twig 0.9%