PHPackages                             geonative/garbage-collector - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. geonative/garbage-collector

ActiveLibrary[Database &amp; ORM](/categories/database)

geonative/garbage-collector
===========================

Doctrine Entities garbage collector

0.5(2mo ago)015.2k↓50%[1 PRs](https://github.com/geonativefr/garbage-collector/pulls)MITPHPPHP &gt;=8.4CI passing

Since Dec 8Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/geonativefr/garbage-collector)[ Packagist](https://packagist.org/packages/geonative/garbage-collector)[ RSS](/packages/geonative-garbage-collector/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (14)Versions (10)Used By (0)

Doctrine Garbage Collector
==========================

[](#doctrine-garbage-collector)

This package is a Symfony Bundle providing a "garbage collector" command to prune Doctrine entities that you consider stale.

Installation
------------

[](#installation)

PHP 8.4 or above is required.

```
composer require geonative/garbage-collector
```

Configuration
-------------

[](#configuration)

1. Add the bundle into your `config/bundles.php` (likely to be done automatically with Symfony Flex).
2. Update your configuration:

```
# config/packages/doctrine.yaml
doctrine:
  orm:
    mappings:
      GarbageCollectorBundle: ~
```

```
# config/services.yaml
services:
    _instanceof:
        GeoNative\GarbageCollector\PrunableRepositoryInterface:
            tags: [!php/const GeoNative\GarbageCollector\Services\GarbageCollector::PRUNABLE_REPOSITORY]
```

3. Update your database schema:

```
php bin/console doctrine:schema:update --dump-sql --force
```

4. Implement `GeoNative\GarbageCollector\PrunableRepositoryInterface` on your repositories:
    1. `getGarbageCollectorCheckInterval()` should return the minimum interval between checks, to avoid ruining your DB performances
    2. `pruneStaleEntities()` should actually perform removals and return the number of entities which have been removed.

If your entities should be pruned against a DateTime column, you can use `GeoNative\GarbageCollector\PruneStaleEntitiesTrait` to get started faster.

Usage
-----

[](#usage)

### Oneshot

[](#oneshot)

```
php bin/console gc:entities:prune
```

You can store this in a crontab to periodically cleanup your entities.

### Daemonize

[](#daemonize)

This command can also run in a loop and be daemonized with supervisord or systemctl.

The `react/event-loop` package is required.

```
php bin/console gc:entities:prune --loop=5
```

The Garbage Collector will pass every 5 seconds.

### Lock

[](#lock)

If your application runs on multiple hosts, you may want to [prevent several instances](https://symfony.com/doc/current/console/lockable_trait.html)of the Garbage Collector from running simultaneously. To do so, just add a `--lock` option:

```
php bin/console gc:entities:prune --lock
```

Tests
-----

[](#tests)

```
vendor/bin/pest
```

License
-------

[](#license)

MIT.

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance88

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 76.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~310 days

Recently: every ~304 days

Total

6

Last Release

70d ago

PHP version history (5 changes)0.1PHP &gt;=8.0

0.2.1PHP &gt;=8.1

0.3PHP &gt;=8.2

0.4PHP &gt;=8.3

0.5PHP &gt;=8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/acdd1a8ee0e657ddd06cf11f98a32100ef7121afb8aa270a5b295f5c29c038b3?d=identicon)[bpolaszek](/maintainers/bpolaszek)

---

Top Contributors

[![misaert](https://avatars.githubusercontent.com/u/12974251?v=4)](https://github.com/misaert "misaert (13 commits)")[![bpolaszek](https://avatars.githubusercontent.com/u/5569077?v=4)](https://github.com/bpolaszek "bpolaszek (4 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/geonative-garbage-collector/health.svg)

```
[![Health](https://phpackages.com/badges/geonative-garbage-collector/health.svg)](https://phpackages.com/packages/geonative-garbage-collector)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[kimai/kimai

Kimai - Time Tracking

4.6k7.4k1](/packages/kimai-kimai)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1022.4k](/packages/rcsofttech-audit-trail-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
