PHPackages                             bytespin/console-command-scheduler-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. bytespin/console-command-scheduler-bundle

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

bytespin/console-command-scheduler-bundle
=========================================

Provides easy scheduling for symfony console commands using latest Symfony messenger/scheduler components

2.0.2(2mo ago)0109MITPHPPHP &gt;=8.4

Since Nov 21Pushed 2mo agoCompare

[ Source](https://github.com/ByteSpin/ConsoleCommandSchedulerBundle)[ Packagist](https://packagist.org/packages/bytespin/console-command-scheduler-bundle)[ Docs](https://github.com/ByteSpin/ConsoleCommandSchedulerBundle)[ RSS](/packages/bytespin-console-command-scheduler-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (46)Versions (31)Used By (0)

Copyright (c) 2023 Greg LAMY

This is a public project hosted on GitHub :

This bundle was originally developed as part of an ETL project.

ByteSpin/ConsoleCommandSchedulerBundle is a Symfony 6.3 simple bundle that allows you to schedule console commands easily:

- Use the latest messenger/scheduler Symfony 6.3+ components,
- Log all console commands data (last execution time, duration, return code) in database and log file,
- An admin interface is available with the help of EasyCorp/EasyAdmin bundle
- Specific events are available for deeper integration with your application and/or notification system
- An extendable notification system (by email)

Note

This project is still at beta state.

**Feel free to submit bug and/or pull requests!**

You can check the [CHANGELOG](CHANGELOG) to see the latest improvements and fixes.

Just keep in mind that I want to keep it as simple as possible!

Important

Version 1.0.13 requires schema update. Please run : `php php bin/console doctrine:schema:update --force`

Requirements
------------

[](#requirements)

- php 8.2+
- Symfony 6.3+

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

[](#installation)

1. First install the bundle:

```
composer require bytespin/console-commande-scheduler-bundle
```

2. Then update the database schema:

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

Updating the bundle
-------------------

[](#updating-the-bundle)

For now, the bundle still lacks a custom recipe to manage database schema upgrade when needed.

**Do not forget to update the database schema when updating the bundle**

The last version that includes schema modifications is : 1.1.0

Manual bundle registration
--------------------------

[](#manual-bundle-registration)

You will need to manually register the bundle in your application.

To do this, follow these steps:

1. Open the file `config/bundles.php` in your Symfony application.
2. Add the following line to the array returned by this file:

    ```
    ByteSpin\ConsoleCommandSchedulerBundle\ConsoleCommandSchedulerBundle::class => ['all' => true],
    ```
3. Save the file. Your bundle is now registered and ready to be used in your application.

Make sure to perform this step after you have installed the bundle using Composer, but before you use any of its features in your application.

Configuration
-------------

[](#configuration)

You will have to configure the entity manager to be used with the ByteSpin\\ConsoleCommandSchedulerBundle entities. This has to be done once after installation. We provide a script to automatise this step ; please run :

```
bin/console bytespin:configure-console-command-scheduler
```

If you prefer to do this by yourself, add the following lines just within your entity manager 'mappings:' key in doctrine.yaml :

```
# src/config/packages/doctrine.yaml
doctrine:
    dbal:
    (...)
    orm:
    (...)
        entity_managers:
            your_entity_manager:
            (...)
                mappings:
                  ByteSpin\ConsoleCommandSchedulerBundle:
                  is_bundle: false
                  type: attribute
                  dir: '%kernel.project_dir%/vendor/bytespin/console-command-scheduler-bundle/src/Entity'
                  prefix: ByteSpin\ConsoleCommandSchedulerBundle\Entity
                  alias: ByteSpin\ConsoleCommandSchedulerBundle

```

Important

If your project contains entities mapped to multiple entity managers, be careful to not use the auto\_mapping: true in your doctrine configuration.

This would prevent the getManagerForClass() function used in the bundle to get the correct entity manager to work properly!

In such case :

- Choose the correct entity manager when you run the configuration script,
- Be sure to remove the 'auto\_mapping: true' key from your doctrine.yaml (or set it to false),
- Be sure that ALL your entities are correctly mapped in the 'mappings:' sections of your doctrine.yaml

Tags Feature (Optional)
-----------------------

[](#tags-feature-optional)

The bundle supports an optional tags system that allows you to categorize and filter scheduled commands. This feature is **disabled by default** and requires configuration to enable.

### Enabling Tags

[](#enabling-tags)

1. Create a Tag entity in your application that implements `ByteSpin\ConsoleCommandSchedulerBundle\Model\TagInterface`:

```
