22h/doctrine-garbage-collection-bundle
deleted_at records, unreferenced entities).symfony/doctrine-bridge) could benefit from automated cleanup.TTL, orphaned relations).postFlush, postCommit) for real-time or scheduled cleanup.doctrine/orm (v2.10+), doctrine/doctrine-bundle, and symfony/messenger (for async cleanup).postInsert, postUpdate) to mimic Symfony’s postFlush.GarbageCollectionCollectorInterface for Eloquent models.Bundle system is nonexistent; would need a standalone package (e.g., laravel-doctrine-garbage-collection).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Doctrine Dependency | High | Evaluate if Doctrine ORM is a hard requirement or if DBAL-only mode suffices. |
| Event System Gaps | Medium | For Laravel, implement custom event listeners (e.g., ModelObserver) to trigger cleanup. |
| Performance Overhead | Medium | Test with large datasets to ensure cleanup doesn’t block requests (use async via Messenger). |
| Configuration Complexity | Low | YAML/XML config may be unfamiliar to Laravel devs; propose a PHP array-based config alternative. |
| Version Skew | Low | Bundle targets Symfony 5.4+; Laravel’s Doctrine DBAL (v2.10+) should be compatible. |
deleted_at bloat) or non-urgent (e.g., audit logs)?PostCommitEvent → Laravel’s queue:work + Model::booted().| Component | Symfony Fit | Laravel Fit (Adapted) |
|---|---|---|
| ORM Layer | ✅ Doctrine | ⚠️ DBAL-only or Eloquent wrapper needed |
| Event System | ✅ postFlush |
⚠️ Custom ModelObserver or ServiceProvider |
| Configuration | ✅ YAML/XML | ⚠️ PHP array or custom annotation support |
| Async Processing | ✅ Messenger | ✅ Laravel Queues |
| CLI Tools | ✅ doctrine:garbage-collection |
⚠️ Custom Artisan command |
Symfony (Native):
composer require 22h/doctrine-garbage-collection-bundle
config/bundles.php and define collectors in config/packages/doctrine_garbage_collection.yaml.php bin/console doctrine:garbage-collection:run.cron or symfony/clock).Laravel (Adapted):
composer require doctrine/dbal
vendor/bin/garbage-collector).Model::registerGlobalScopes() to hook into deleted_at queries.spatie/laravel-doctrine-garbage-collection).GarbageCollectionServiceProvider to bootstrap Doctrine events.GarbageCollectionFacade for Artisan commands.EloquentCollector extending the bundle’s interface.// app/Providers/GarbageCollectionServiceProvider.php
public function boot()
{
Model::registerGlobalObserver(new GarbageCollectionObserver());
}
doctrine/dbal (v3.x) is compatible; Eloquent requires no changes to core logic.ON DELETE CASCADE is handled by Doctrine).audit_logs).10K records/hour cleanup rate).How can I help you explore Laravel packages today?