PHPackages                             endroid/flusher - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. endroid/flusher

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

endroid/flusher
===============

Endroid Flusher

2.3.1(2mo ago)78.0k1MITPHPPHP ^8.4CI passing

Since Jul 24Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/endroid/flusher)[ Packagist](https://packagist.org/packages/endroid/flusher)[ Docs](https://github.com/endroid/flusher)[ GitHub Sponsors](https://github.com/endroid)[ RSS](/packages/endroid-flusher/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (24)Used By (0)

Flusher
=======

[](#flusher)

*By [endroid](https://endroid.nl/)*

[![Latest Stable Version](https://camo.githubusercontent.com/8eee1d524f4da66b74eeb27b244d8b847e0fc8f1dbae0749b67e9a30efbd8ad2/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656e64726f69642f666c75736865722e737667)](https://packagist.org/packages/endroid/flusher)[![Build Status](https://github.com/endroid/flusher/workflows/CI/badge.svg)](https://github.com/endroid/flusher/actions)[![Total Downloads](https://camo.githubusercontent.com/cfd3ca546eea51fe3cdded245119b12c3cceebde658d74241e65e305906f0829/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656e64726f69642f666c75736865722e737667)](https://packagist.org/packages/endroid/flusher)[![Monthly Downloads](https://camo.githubusercontent.com/430563f2e81a9851dc1f439a9855443e6bb98737ef9431398e2dd66694794d9b/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f656e64726f69642f666c75736865722e737667)](https://packagist.org/packages/endroid/flusher)[![License](https://camo.githubusercontent.com/51856049a1b173aa0ff328cf921e9f6f98d135e828ffeeb6dbb358464d702813/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f656e64726f69642f666c75736865722e737667)](https://packagist.org/packages/endroid/flusher)

When you import or modify large amounts of data it is often necessary to define the optimal batch size before flushing: small batch sizes perform bad because of the overhead in each flush. And batch sizes that are too large perform bad because of the high memory usage and the need to calculate a large change set. Also the batch size you choose can give different results on different types of hardware.

This library helps you write entities to the database without worrying about the batch size. It incrementally tries new batch sizes (given a step size), sticks with the one that gives the highest performance or switches to a better batch size if the circumstances have changed.

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

[](#installation)

Use [Composer](https://getcomposer.org/) to install the library.

```
$ composer require endroid/flusher
```

Usage
-----

[](#usage)

In order to enable auto flushing you first need to create a Flusher for the entity manager you are currently using.

```
$flusher = new Flusher($manager);
```

Then when you performed operations on your entity manager you can call the flush() method on the flusher any time to notify there are changes.

```
for ($n = 1; $n setName('Task '.$n);
    $manager->persist($task);
    $flusher->flush();
}
```

Because there is no way of knowing if there are pending flushes at the end you need to call finish() to make sure all data is flushed.

```
$flusher->finish();
```

Versioning
----------

[](#versioning)

Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility breaking changes will be kept to a minimum but be aware that these can occur. Lock your dependencies for production and test your code when upgrading.

License
-------

[](#license)

This bundle is under the MIT license. For the full copyright and license information please view the LICENSE file that was distributed with this source code.

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance85

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity90

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 100% 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 ~142 days

Recently: every ~218 days

Total

23

Last Release

76d ago

Major Versions

1.x-dev → 2.0.02017-12-06

PHP version history (8 changes)1.0.0PHP &gt;=5.6

2.0.0PHP &gt;=7.1

2.0.2PHP &gt;=7.2

2.0.3PHP ^7.3||^8.0

2.1.0PHP ^7.4||^8.0

2.1.2PHP ^8.1

2.2.0PHP ^8.2

2.3.0PHP ^8.4

### Community

Maintainers

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

---

Top Contributors

[![endroid](https://avatars.githubusercontent.com/u/537253?v=4)](https://github.com/endroid "endroid (72 commits)")

---

Tags

phpendroidflusher

### Embed Badge

![Health badge](/badges/endroid-flusher/health.svg)

```
[![Health](https://phpackages.com/badges/endroid-flusher/health.svg)](https://phpackages.com/packages/endroid-flusher)
```

###  Alternatives

[endroid/qr-code

Endroid QR Code

4.8k67.6M347](/packages/endroid-qr-code)

PHPackages © 2026

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