Download the PHP package tourze/symfony-schedule-entity-clean-bundle without Composer
On this page you can find all versions of the php package tourze/symfony-schedule-entity-clean-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package symfony-schedule-entity-clean-bundle
Symfony Schedule Entity Clean Bundle
中文
A Symfony bundle for automatically cleaning old entity data based on scheduled cron expressions.
Features
- Automatically clean old entity data based on cron expressions
- Configurable retention period for each entity
- Custom retention period via environment variables
- Asynchronous processing using Symfony Messenger
- Event dispatching after cleaning operations
Installation
Register the bundle in your bundles.php
:
Quick Start
-
Mark your entity class with the
AsScheduleClean
attribute: -
Ensure your entity has a
createTime
field. The bundle uses this field to determine which records to delete. - The bundle will automatically register a cron job that runs every minute to check if any entities need cleaning.
Configuration
The AsScheduleClean
attribute accepts the following parameters:
expression
: A cron expression that determines when to clean the entity (default: '0 0 * ', which runs at midnight every day)defaultKeepDay
: The number of days to keep records (default: 7)keepDayEnv
: An optional environment variable name that can override the defaultKeepDay value
Events
The bundle dispatches a ScheduleEntityCleanFinishEvent
after successfully cleaning entity data. You can listen to this event to perform custom actions after the cleaning process.
Requirements
- PHP 8.1 or higher
- Symfony 6.4 or higher
- Doctrine ORM
- Entity must have a
createTime
field
License
The MIT License (MIT). Please see License File for more information.
All versions of symfony-schedule-entity-clean-bundle with dependencies
nesbot/carbon Version ^2.72 || ^3
doctrine/doctrine-bundle Version ^2.13
symfony/event-dispatcher Version ^6.4
symfony/framework-bundle Version ^6.4
tourze/symfony-cron-job-bundle Version 0.0.*
dragonmantank/cron-expression Version ^3.4