Symfony bundle that integrates dragonmantank/cron-expression

Installs: 21 917

Dependents: 1

Suggesters: 0

Security: 0

Stars: 8

Watchers: 1

Forks: 4

Open Issues: 3


v1.4.0 2021-02-17 12:37 UTC


Symfony bundle that integrates dragonmantank/cron-expression

Latest Version Latest Unstable Version Software License Build Status Quality Score


Step 1: Download

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require setono/cron-expression-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the bundle

If you use Symfony Flex it will be enabled automatically. Else you need to add it to the bundles.php.

// config/bundles.php

return [
    // ...
    Setono\CronExpressionBundle\SetonoCronExpressionBundle::class => ['all' => true],
    // ...


Add to form type

// src/Form/TaskType.php

namespace App\Form;

use Setono\CronExpressionBundle\Form\Type\CronExpressionType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;

class TaskType extends AbstractType
    public function buildForm(FormBuilderInterface $builder, array $options)
            ->add('schedule', CronExpressionType::class)
            ->add('save', SubmitType::class)

Add to entity

// src/Entity/Task.php

namespace App\Entity;

use Cron\CronExpression;
use Doctrine\ORM\Mapping as ORM;

class Task
    // ...
     * @var CronExpression
     * @ORM\Column(type="cron_expression") 
    private $schedule;
    // ...