lamoda / cleaner
Library for clean old data from different storages
Installs: 9 300
Dependents: 2
Suggesters: 0
Security: 0
Stars: 3
Watchers: 17
Forks: 0
Open Issues: 0
Requires
- php: ^7.1 || ^8.0
Requires (Dev)
- doctrine/dbal: ^2.6
- friendsofphp/php-cs-fixer: ^2.14
- phpunit/phpunit: ^7.5.20 || ^8.5.12 || ^9.0
Suggests
- lamoda/cleaner-bundle: For integration with Symfony
This package is auto-updated.
Last update: 2023-06-11 15:20:54 UTC
README
Library that provides classes to clear old data from different storages, firstly from databases.
Installation
- Install library with composer:
composer require lamoda/cleaner
Standalone usage
Example of DoctrineDBALCleaner usage, which relies on doctrine/dbal connection.
use Lamoda\Cleaner\DB\Config\DBCleanerConfigFactory; use Lamoda\Cleaner\DB\DoctrineDBALCleaner; $config = DBCleanerConfigFactory::create([ 'query' => "DELETE * FROM big_table WHERE created_at < NOW() - (:interval || ' days')::interval", 'parameters' => [ 'interval' => 90, ], ]); /** @var \Doctrine\DBAL\Connection $connection */ $connection = $entityManager->getConnection(); $cleaner = new DoctrineDBALCleaner($connection, $config); $cleaner->clear();