setono / cron-expression-bundle
Symfony bundle that integrates dragonmantank/cron-expression
Installs: 131 210
Dependents: 3
Suggesters: 0
Security: 0
Stars: 23
Watchers: 3
Forks: 10
Open Issues: 2
Type:symfony-bundle
Requires
- php: >=7.4
- doctrine/dbal: ^3.4 || ^4.0
- doctrine/doctrine-bundle: ^1.9 || ^2.0
- dragonmantank/cron-expression: ^2.2 || ^3.0
- symfony/config: ^5.4 || ^6.0
- symfony/dependency-injection: ^5.4 || ^6.0
- symfony/form: ^5.4 || ^6.0
- symfony/http-kernel: ^5.4 || ^6.0
- symfony/options-resolver: ^5.4 || ^6.0
- symfony/property-info: ^5.4 || ^6.0
- symfony/validator: ^5.4 || ^6.0
- webmozart/assert: ^1.10
Requires (Dev)
- matthiasnoback/symfony-dependency-injection-test: ^4.3
- phpdocumentor/reflection-docblock: ^5.3
- phpunit/phpunit: ^9.5
- psalm/plugin-phpunit: ^0.16.1
- roave/security-advisories: dev-latest
- setono/code-quality-pack: ^2.1.3
README
Symfony bundle that integrates dragonmantank/cron-expression
Installation
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
.
<?php // config/bundles.php return [ // ... Setono\CronExpressionBundle\SetonoCronExpressionBundle::class => ['all' => true], // ... ];
Usage
Add to form type
<?php // 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) { $builder ->add('task') ->add('schedule', CronExpressionType::class) ->add('save', SubmitType::class) ; } }
Add to entity
<?php declare(strict_types=1); namespace App\Entity; use Cron\CronExpression; use Doctrine\ORM\Mapping as ORM; use Setono\CronExpressionBundle\Doctrine\DBAL\Types\CronExpressionType; #[ORM\Entity] class Task { #[ORM\Column(type: CronExpressionType::CRON_EXPRESSION_TYPE)] private CronExpression $schedule; }