Download the PHP package tuxweb-it/amp-sql-queue without Composer

On this page you can find all versions of the php package tuxweb-it/amp-sql-queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package amp-sql-queue

amp-sql-queue

Persistent, async, non-blocking SQL job queue for PHP 8.3+, AMPHP, Revolt, PostgreSQL, MySQL, and MariaDB.

amp-sql-queue provides one queue API over two SQL storage backends:

It is designed as a small library, not a framework integration. There is no PDO, Doctrine DBAL, Symfony, Laravel, or blocking database client in the runtime path.

Status

This project is an early open source base. The core API, worker, SQL storage classes, migrations, examples, PHPUnit tests, and PHPStan configuration are present. Database-backed integration tests are available and run when PostgreSQL/MySQL DSNs are configured.

Features

Requirements

Core runtime dependencies:

Install the database driver you need:

Development dependencies:

Installation

For MySQL or MariaDB:

For local development in this repository:

Database Schema

Apply the migration for your database.

PostgreSQL:

MySQL / MariaDB:

The logical schema uses two tables:

Important fields include:

Supported statuses:

Dispatching Jobs

PostgreSQL example:

MySQL / MariaDB use the same queue API:

Running Workers

The worker:

Worker Hooks

Worker hooks are optional and framework-agnostic. Use them to bridge queue activity into logs, metrics, tracing, or a workflow runtime event stream.

Emitted events include:

Long-Running Jobs

Workers reserve jobs with a lease. If a job may run longer than the lease, extend it from the handler before it expires:

For workflows that pause for external input, do not hold the lease while waiting. Persist the workflow interrupt, acknowledge the current job, and dispatch a later resume job when input arrives.

Retry and Backoff

maxAttempts is stored on the job at dispatch time. This makes retry behavior durable across worker restarts and multiple processes.

The worker owns the delay policy. By default it uses ExponentialBackoffStrategy.

When attempts are exhausted, the job is marked failed and copied into amp_queue_failed_jobs.

Idempotency

Set an idempotency key to avoid duplicate dispatches for the same queue:

The uniqueness scope is:

NULL idempotency keys are allowed, so jobs without a key are never deduplicated.

Storage Behavior

PostgreSQL

PostgreSQL uses:

MySQL / MariaDB

MySQL and MariaDB use:

MariaDB 11.8 is covered by the integration suite in this workspace. Under concurrent reservation, MariaDB may return one job and one empty reservation while another pending job remains available; the next reservation picks it up. This preserves safety while PostgreSQL shows stronger immediate parallel reservation behavior.

Both storage classes expose the same public API.

Public Contracts

The main extension points are:

Default implementations:

Examples

Example scripts are available in examples/:

Run them after applying migrations and setting the database DSN:

Development

Install dependencies:

Run checks:

Run only unit tests:

Integration Tests

Integration tests require real PostgreSQL and MySQL/MariaDB databases. The included Docker Compose file is only for development and CI convenience; it is not used by the library at runtime.

Start databases:

Set DSNs:

Run integration tests:

If the DSNs are not set, integration tests are skipped.

Design Notes

This package deliberately keeps classes small and avoids framework-specific behavior. The queue facade handles API-level concerns. Storage classes handle database-specific SQL. The worker handles concurrency, retry, and graceful shutdown.

Use AMPHP-compatible libraries inside handlers. Blocking calls in a handler will block the event loop and reduce concurrency.

License

MIT. See LICENSE.


All versions of amp-sql-queue with dependencies

PHP Build Version
Package Version
Requires amphp/amp Version ^3.1
php Version ^8.3
revolt/event-loop Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tuxweb-it/amp-sql-queue contains the following files

Loading the files please wait ...