PHPackages                             danc0/balin-queue - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. danc0/balin-queue

ActiveLibrary[Queues &amp; Workers](/categories/queues)

danc0/balin-queue
=================

A simple PHP database based queue

v0.1.4(10mo ago)036UnlicensePHPPHP &gt;=8.2

Since Nov 28Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/dvnc0/balin-queue)[ Packagist](https://packagist.org/packages/danc0/balin-queue)[ RSS](/packages/danc0-balin-queue/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (6)Used By (0)

Balin Queue
===========

[](#balin-queue)

A simple database queue for PHP.

Supports:

- MySQL/MariaDB
- SQLite3

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

[](#installation)

```
composer require danc0/balin-queue
```

Config
------

[](#config)

```
$Balin = Balin::load([
	'path' => __DIR__,
	'database' => [
		'driver' => 'sqlite',
		'name' => 'balin_queue.sqlite',
		'dsn' => 'sqlite:' . __DIR__ . '/balin_queue.sqlite'
	]
]);
```

Driver Options:

- `sqlite`
- `mysql`

A flag file is created in `path` to indicate that the queue has been created, make sure the path is writable. This is also where the sqlite database will be created if using sqlite.

Usage
-----

[](#usage)

You would first create an instance of Balin somewhere with the config example above. To access the instance of Balin you would use the following code:

```
$Balin = Balin::queue();
```

At this point you have a number of public methods you can use.

### Push to queue

[](#push-to-queue)

`push(string $task_name, array $payload, int $priority = 99, int $max_attempts = 3, string $scheduled_at = null)`

This will push a task to the queue. Use lower numbers for higher priority. The default priority is 99. The default max attempts is 3. The default scheduled at is null. Using scheduled at will delay the task until the time specified.

### Getting a job

[](#getting-a-job)

`pop()`

This will return the next job in the queue. If there are no jobs in the queue it will return `null`. This will pull based on priority, scheduled at time, and created time.

`popTask(string $task_name)`

This will return the next job in the queue for the specified task name. If there are no jobs in the queue it will return `null`. This will pull based on priority, scheduled at time, and created time, but only for the specified task name.

### Update a job

[](#update-a-job)

`success(int $id)`

This will mark the job as successful and remove it from the queue.

`failure(int $id, string|null $scheduled_at = null)`

This will mark the job as failed and put it back in the queue. If the job has reached the max attempts it will be removed from the queue. If you pass a scheduled at time it will delay the job until that time.

`error(int $id, string $error_message)`

This will mark the job as having an error and remove it from the queue.

Releasing orphaned jobs
-----------------------

[](#releasing-orphaned-jobs)

`releaseLockedJobs(int $locked_max_time = 3600)`

This will release any jobs that have been locked for more than the specified time. The default is 3600 seconds (1 hour).

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance54

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

Total

5

Last Release

313d ago

### Community

Maintainers

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

---

Top Contributors

[![dvnc0](https://avatars.githubusercontent.com/u/116893638?v=4)](https://github.com/dvnc0 "dvnc0 (9 commits)")

---

Tags

mysqlphpphp-queuephp8queuesqlite3

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/danc0-balin-queue/health.svg)

```
[![Health](https://phpackages.com/badges/danc0-balin-queue/health.svg)](https://phpackages.com/packages/danc0-balin-queue)
```

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[enqueue/enqueue

Message Queue Library

19820.0M56](/packages/enqueue-enqueue)[deliciousbrains/wp-background-processing

WP Background Processing can be used to fire off non-blocking asynchronous requests or as a background processing tool, allowing you to queue tasks.

1.1k409.8k6](/packages/deliciousbrains-wp-background-processing)[react/async

Async utilities and fibers for ReactPHP

2228.8M171](/packages/react-async)[react/promise-stream

The missing link between Promise-land and Stream-land for ReactPHP

11512.9M45](/packages/react-promise-stream)[illuminate/bus

The Illuminate Bus package.

6043.8M409](/packages/illuminate-bus)

PHPackages © 2026

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