PHPackages                             versusbassz/wp-batcher - 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. versusbassz/wp-batcher

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

versusbassz/wp-batcher
======================

Iterate over thousands of posts/users/etc. in WordPress without getting OOM and writing boilerplate code

0.1.0(4y ago)1041[16 issues](https://github.com/versusbassz/wp-batcher/issues)GPL-2.0-or-laterPHPPHP &gt;=5.6

Since Jan 13Pushed 4y ago2 watchersCompare

[ Source](https://github.com/versusbassz/wp-batcher)[ Packagist](https://packagist.org/packages/versusbassz/wp-batcher)[ Docs](https://github.com/versusbassz/wp-batcher)[ RSS](/packages/versusbassz-wp-batcher/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

WP-Batcher
==========

[](#wp-batcher)

If you need to change many items of the same type (posts, users, etc.) in WordPress (with possible Out-of-Memory result) this library helps you to write less code and avoid OOM.

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

[](#installation)

```
composer require versusbassz/wp-batcher 0.1.*
```

How to use
----------

[](#how-to-use)

Imagine you have 100000 posts in a database, and you need to iterate over them and change somehow.

Of course, you can't just use `get_posts( [ 'nopaging' => true ] )`, because you'll get `Fatal error: memory limit has been exceeded bla bla bla... `.

So to do the job you need to handle you posts consequentially chunk by chunk (e.g. 100 posts at a time).

The example of code without using the library:

```
$paged = 1;

wp_suspend_cache_addition( true );

while ( true ) {
	$items = get_posts( [
		'posts_per_page' => 100,
		'paged' => $paged,
		'orderby' => 'ID',
		'order' => 'ASC',
	] );

	if ( ! count( $items ) ) {
		break;
	}

	foreach ( $items as $item ) {
		// Payload
	}

	++$paged;
}

wp_suspend_cache_addition( false );
```

With using the library the code above turns into to:

```
use \Versusbassz\WpBatcher\WpBatcher;

$iterator = WpBatcher::get_posts();

foreach ( $iterator as $item ) {
	// Payload
}
```

And the library does more than just `wp_suspend_cache_addition()` under the hood.

Documentation
-------------

[](#documentation)

See [Wiki](https://github.com/versusbassz/wp-batcher/wiki)

Compatibility
-------------

[](#compatibility)

- PHP &gt;= 5.6 (the target version is a version [required by WordPress](https://wordpress.org/about/requirements/))
- WordPress 5.7+

Versioning and stability
------------------------

[](#versioning-and-stability)

The project follows

License
-------

[](#license)

The license of the project is GPL v2 (or later)

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

1577d ago

### Community

Maintainers

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

---

Top Contributors

[![versusbassz](https://avatars.githubusercontent.com/u/2342074?v=4)](https://github.com/versusbassz "versusbassz (53 commits)")

---

Tags

iteratorlibrarywordpresswordpressiterator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/versusbassz-wp-batcher/health.svg)

```
[![Health](https://phpackages.com/badges/versusbassz-wp-batcher/health.svg)](https://phpackages.com/packages/versusbassz-wp-batcher)
```

###  Alternatives

[tgmpa/tgm-plugin-activation

TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes (and plugins).

1.8k222.5k13](/packages/tgmpa-tgm-plugin-activation)[aristath/kirki

Extending the WordPress customizer

1.3k73.0k4](/packages/aristath-kirki)[afragen/git-updater

A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs.

3.3k1.6k](/packages/afragen-git-updater)[chdemko/sorted-collections

Sorted Collections for PHP &gt;= 8.2

222.5M3](/packages/chdemko-sorted-collections)[justintadlock/hybrid-carbon

God-like post featured image script.

202.5k](/packages/justintadlock-hybrid-carbon)

PHPackages © 2026

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