adgoal / cleaner-bundle
Symfony bundle for adgoal/cleaner library
Installs: 3 770
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 3
Type:symfony-bundle
Requires
- php: ^7.1
- lamoda/cleaner: *
- symfony/config: ^4.0 || ^5.0
- symfony/console: ^4.0 || ^5.0
- symfony/dependency-injection: ^4.0 || ^5.0
- symfony/http-kernel: ^4.0 || ^5.0
- symfony/yaml: ^4.0 || ^5.0
Requires (Dev)
- ext-pdo_sqlite: *
- doctrine/dbal: ^2.6
- doctrine/doctrine-bundle: ^2.0
- friendsofphp/php-cs-fixer: ^2.14
- phpunit/phpunit: ^7.5
- symfony/framework-bundle: ^4.0 || ^5.0
- symfony/monolog-bridge: ^4.0 || ^5.0
- symfony/monolog-bundle: ^3.2
This package is auto-updated.
Last update: 2024-10-16 18:02:44 UTC
README
Symfony Bundle for lamoda/cleaner library.
Installation
- Install the Bundle with composer:
$ composer require adgoal/cleaner-bundle
- Enable the Bundle:
<?php // config/bundles.php return [ // ... Lamoda\CleanerBundle\LamodaCleanerBundle::class => ['all' => true], // ... ];
- Configure cleaners for your project:
lamoda_cleaner: db: queue: transactional: false # optional, default true query: DELETE FROM queue WHERE created_at < NOW() - (:interval || ' days')::interval parameters: interval: 30 types: # optional, if required special type handling - integer # you can use multiple queries at one command multi_tables: class: Lamoda\Cleaner\DB\DoctrineDBALCleaner transactional: true queries: - query: DELETE FROM table_a WHERE created_at < NOW() - (:interval || ' days')::interval parameters: interval: 30 - query: DELETE FROM table_b WHERE created_at < NOW() - (:interval || ' days')::interval parameters: interval: 30
You can also add your own storage cleaners.
To do this you have to implement Lamoda\Cleaner\CleanerInterface
and register your cleaner with tag:
services: custom_cleaner: class: My\Custom\Implementation tags: - { name: 'lamoda_cleaner.db', alias: 'custom' }
Usage
Bundle adds command to run cleaners.
Run all cleaners in DB:
./bin/console cleaner:clear db
or only one of them:
./bin/console cleaner:clear db queue