lamoda/cleaner
Library for clean old data from different storages
0.1
2019-02-11 17:13 UTC
Requires
- php: ^7.1
Requires (Dev)
- doctrine/dbal: ^2.6
- friendsofphp/php-cs-fixer: ^2.14
- phpunit/phpunit: ^7.5
Suggests
- lamoda/cleaner-bundle: For integration with Symfony
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();