PHPackages                             underpin/batch-task-loader - 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. underpin/batch-task-loader

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

underpin/batch-task-loader
==========================

Batch task Loader for Underpin

1.1.0(4y ago)122[1 issues](https://github.com/Underpin-WP/batch-task-loader/issues)GPL-2.0-or-laterPHP

Since May 6Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Underpin-WP/batch-task-loader)[ Packagist](https://packagist.org/packages/underpin/batch-task-loader)[ RSS](/packages/underpin-batch-task-loader/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (3)Dependencies (3)Versions (5)Used By (0)

Underpin batch task Loader
==========================

[](#underpin-batch-task-loader)

Loader That assists with adding batch tasks to a WordPress website.

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

[](#installation)

### Using Composer

[](#using-composer)

`composer require underpin/batch-task-loader`

### Manually

[](#manually)

This plugin uses a built-in autoloader, so as long as it is required *before*Underpin, it should work as-expected.

`require_once(__DIR__ . '/underpin-batch-tasks/batch-tasks.php');`

Setup
-----

[](#setup)

1. Install Underpin. See [Underpin Docs](https://www.github.com/underpin-wp/underpin)
2. Register new batch tasks as-needed.

Batch tasks
-----------

[](#batch-tasks)

As a plugin matures, the need to break a big task (like replacing the value of every record in a database) into smaller tasks (replace 20 records until all are replaced) becomes commonplace.

The problem is, WordPress doesn't provide a way to create these tasks easily. This loader makes it possible to register and build your own batch tasks quickly.

Example
-------

[](#example)

A very basic example could look something like this.

```
\Underpin\underpin()->batch_tasks()->add( 'example-batch', [
    'description'             => 'A batch task that does nothing 20 times',
    'name'                    => 'Batch Task Example',
    'tasks_per_request'       => 50,
    'stop_on_error'           => true,
    'total_items'             => 1000,
    'notice_message'          => 'Run the most pointless batch task ever made.',
    'button_text'             => 'LETS GO.',
    'capability'              => 'administrator',
    'batch_id'                => 'example-batch',
    'task_callback'           => '__return_null', // The callback that iterates on every task
    'finish_process_callback' => '__return_null', // The callback that runs after everything is finished
    'prepare_task_callback'   => '__return_null', // The callback that runs before each task
    'finish_task_callback'    => '__return_null', // The callback that runs after each task
  ] );
```

Alternatively, you can extend `batch task` and reference the extended class directly, like so:

```
underpin()->batch_tasks()->add('key','Namespace\To\Class');
```

This is especially useful when using batch tasks, since they have a tendency to get quite long, and nest deep.

Enqueuing the batch notice
--------------------------

[](#enqueuing-the-batch-notice)

Once a batch task is registered, you can instruct Underpin to display the admin notice to run this task like so:

```
Underpin\underpin()->batch_tasks()->enqueue('example-batch');
```

This will add a batch task notice to the admin area. Once clicked, the batch task will run, with a progress bar to indicate progress. When complete, it will self-close.

[![image](https://user-images.githubusercontent.com/8210827/116898675-87dcf080-abeb-11eb-9514-0f31566e90ca.png)](https://user-images.githubusercontent.com/8210827/116898675-87dcf080-abeb-11eb-9514-0f31566e90ca.png)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 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 ~101 days

Total

3

Last Release

1637d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e6206223bd6f2a57b8ac80605b1b5c3521faaec18ad3f20f25fb728a9a13784?d=identicon)[tstandiford](/maintainers/tstandiford)

---

Top Contributors

[![alexstandiford](https://avatars.githubusercontent.com/u/8210827?v=4)](https://github.com/alexstandiford "alexstandiford (16 commits)")

---

Tags

background-taskbatch-taskhacktoberfestloaderunderpinwordpress

### Embed Badge

![Health badge](/badges/underpin-batch-task-loader/health.svg)

```
[![Health](https://phpackages.com/badges/underpin-batch-task-loader/health.svg)](https://phpackages.com/packages/underpin-batch-task-loader)
```

###  Alternatives

[terminal42/contao-conditionalformfields

conditionalformfields extension for Contao Open Source CMS; Display form fields based on conditionis!

2168.5k1](/packages/terminal42-contao-conditionalformfields)[dusanbre/laravel-tolgee

Help with Laravel integration of Tolgee service

145.5k](/packages/dusanbre-laravel-tolgee)

PHPackages © 2026

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