PHPackages                             frcho/crontask - 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. frcho/crontask

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

frcho/crontask
==============

The easy way to realize cron task using Symfony 4, 5

1.1.1(5y ago)56.5k↓25%MITPHPPHP &gt;=7.0

Since Aug 17Pushed 5y ago2 watchersCompare

[ Source](https://github.com/frcho/crontask)[ Packagist](https://packagist.org/packages/frcho/crontask)[ RSS](/packages/frcho-crontask/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (9)Used By (0)

Crontask Bundle
===============

[](#crontask-bundle)

Creating new cron jobs for every trivial tasks is a time-consuming task, though. And depending on the environment your application will be hosted in, you may not always be able to add a cron job to the system whenever you feel like it.

Installation
============

[](#installation)

Step 1: Download the Bundle
---------------------------

[](#step-1-download-the-bundle)

Open a command console and execute the following command to download the latest stable version of this bundle:

```
$ composer require frcho/crontask 1.1.0
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

Implementing interval-based cron tasks in Symfony5 using Symfony commands and a Doctrine entity
===============================================================================================

[](#implementing-interval-based-cron-tasks-in-symfony5-using-symfony-commands-and-a-doctrine-entity)

The Doctrine entity known as the 'CronTask'

If we review the requirements real quick, we'll notice that we want our tasks to be able to do the following:

Run at a specified interval Perform certain actions

This sounds as simple as it is. To begin with, we'll create a CronTask entity we can persist to our database. This entity should be contain an array of actions it can execute. We'll be using Symfony commands as our actions. It'd also be handy if each task had its own identifier.

Create your command
===================

[](#create-your-command)

```
setName('crontasks:default')->setDescription('Creates the commands by default in database.');
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {

        set_time_limit(0);
        ini_set('memory_limit', '-1');
        $container = $this->getApplication()->getKernel()->getContainer();
        $defaultCommands = array(
            array(
                "name" => "Example asset symlinking task",
                "interval" => 2, // Run once every 2 minutes,
                "range" => 'minutes',
                "commands" => 'assets:install --symlink web',
                "isHide" => false, /* "isHide == true, if you have enable view for this bundle, This command doesn't show in the view schedule task" */
                "enabled" => true
            ),
            array(
                "name" => "Example asset task",
                "interval" => 1, // Run once every hour
                "range" => 'hours',
                "commands" => 'cache:clear',
                "enabled" => false
            ),
        );

        $container->get('frcho.crontask_default')->setArrayCommands($defaultCommands);
        return 0;
    }
}
```

\##Note: range support:

- minutes
- hours
- days

Usage
=====

[](#usage)

The command to run other commands

```
$ php bin/console crontasks:run
```

The command to populate de database, with the commands to run by crontask:run

```
$ php bin/console crontasks:default
```

After execute crontasks:default, you should now have a single CronTask in your database, ready to be executed.

Now, you could execute **php bin/console crontasks:run** yourself. Or add that command as an actual cron job that is executed once every few minutes like so:

```
$ crontab -e
Now add your cron job:

# Run every five minutes
*/5 * * * * php path-your-project/bin/console crontasks:run

And there you have it.
One task to rule them all.
```

Update the database schema :

```
bin/console doctrine:schema:update --force
```

License
-------

[](#license)

This bundle is under the [MIT license](https://github.com/frcho/crontask/blob/master/Resources/meta/LICENSE)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~224 days

Recently: every ~281 days

Total

8

Last Release

1988d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.3.9

1.1.0PHP &gt;=7.0

### Community

Maintainers

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

---

Top Contributors

[![frcho](https://avatars.githubusercontent.com/u/2415594?v=4)](https://github.com/frcho "frcho (57 commits)")

---

Tags

symfonycrontaskjobscrontab

### Embed Badge

![Health badge](/badges/frcho-crontask/health.svg)

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

###  Alternatives

[sulu/sulu

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

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

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[jmose/command-scheduler-bundle

This Symfony bundle will allow you to schedule all your commands just like UNIX crontab

3361.4M1](/packages/jmose-command-scheduler-bundle)[dukecity/command-scheduler-bundle

This Symfony bundle will allow you to schedule all your commands just like UNIX crontab

25350.9k5](/packages/dukecity-command-scheduler-bundle)[rewieer/taskschedulerbundle

Task Scheduler with CRON for Symfony

63242.1k](/packages/rewieer-taskschedulerbundle)[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)

PHPackages © 2026

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