Download the PHP package alveby/laravel-queue-manager without Composer

On this page you can find all versions of the php package alveby/laravel-queue-manager. 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 laravel-queue-manager

Laravel Queue Manager

Latest version Tests Downloads

Cancel, delete, pause, reschedule and inspect Laravel queue jobs from code.

Laravel gives you no way to reach a job once it has been queued. This package does, for the Redis queue driver, through a small API and a set of Artisan commands. There is no UI — the assumption is that you are wiring cancellation into your own application flow.

Requirements

Laravel 10 and 11 are out of security support and Composer now refuses to install them, so they are not supported here.

Installation

The provider is auto-discovered. Publish the config if you want to change anything:

Cancelling jobs

cancel() does two things: it records the uuid as cancelled, and — if the job is still pending or delayed — removes it from Redis outright.

What happens depends on where the job was when you called it:

Job was Result
pending removed from the queue immediately
delayed removed from the delayed set immediately
reserved, worker not started worker drops it before handle()
executing right now only stops if the job polls (see below)

A running job cannot be interrupted from outside the process. Give long jobs a place to check in:

Each cancelled() call is one Redis round-trip, so poll per chunk, not per row. abortIfCancelled() is available too — it deletes the job and throws JobWasCancelled so you can unwind out of nested code.

How the worker drops a job

By default a JobProcessing listener deletes cancelled jobs before they run. Worker::process() checks $job->isDeleted() immediately after dispatching that event and returns without calling fire(), so this works for every kind of job — command bus jobs, queued listeners, queued closures and raw Queue::push('Class@method') payloads alike.

The tradeoff is that CallQueuedHandler never runs, so the bookkeeping it normally does is skipped:

If you want the framework's own skip path instead — where chains continue — set cancellation.strategy to middleware and add the middleware to the jobs you want cancellable:

The cancellation flag expires

Cancellation is a flag in Redis with a TTL (cancellation.ttl, 24h by default). A job delayed for longer than that will no longer see it. Raise the TTL if you schedule jobs far into the future.

Pausing queues

Pausing stops workers consuming a queue. Nothing is moved and nothing is lost — jobs keep piling up and start flowing again the moment you resume.

queue:work keeps running throughout; it just sees an empty queue. Pausing is per queue, so --queue=high,low with low paused keeps draining high.

Laravel pauses queues natively too (queue:pause, backed by the cache, read by the worker before it pops). Both flags are written and cleared together, so this package and the framework's own commands never disagree.

On top of that the package swaps the redis connector for a RedisQueue subclass whose pop() returns null while paused. That is the belt to the framework's braces: it keeps working when the cache store is unavailable, and when Queue::disablePolling() has switched the native check off. Set pause.enabled to false to leave the connector alone, or pause.native to false to stop writing the framework's flag.

Horizon subclasses RedisQueue, so the package detects it and extends Horizon's class instead of the framework's. No configuration needed.

Finding jobs

By uuid:

Without a queue hint this walks every queue of every managed connection, so pass one when you know it: QueueManager::find($uuid, 'export').

By tag, which is what the index is for:

Jobs declare their own tags:

class:, queue: and connection: tags are added automatically (index.auto_tags).

Without tags the query walks the real Redis structures instead, which is always accurate but O(n) in queue length:

Other operations

delete() differs from cancel(): it only takes the job out of Redis and leaves no flag, so a job that is already reserved will still run.

Commands

Schedule queue-manager:prune daily if you leave the index on.

Events

Event When
JobCancelled cancel() was called
CancelledJobSkipped a worker actually dropped a cancelled job
JobRemoved a job was deleted out of a queue
QueuePaused / QueueResumed pause state changed

How it works

The package reads and edits the structures Illuminate\Queue\RedisQueue maintains:

Two details matter and are easy to get wrong by hand:

Match on uuid, not on score. Scores in the delayed and reserved sets are timestamps, and jobs routinely share one. The uuid lives in the payload and is stable across the whole lifecycle, including the cjson re-encode Redis performs when a job is reserved.

Keep the notify list in sync. Every push adds a token to :notify and every pop removes one. An LREM on the queue list without a matching LPOP on the notify list leaves the two permanently out of step and wakes workers for jobs that are not there. Every removal here does both in one Lua script.

Its own keys, all under the configured prefix:

A job leaves the tag sets and lqm:jobs as soon as it reaches a terminal state, so those stay proportional to in-flight work rather than to total throughput.

Limitations

Testing

Feature tests need a Redis they are allowed to FLUSHDB:

Tests skip themselves when nothing answers on that port — a run reporting 40-odd skips means Redis was unreachable, not that everything passed. Override with REDIS_HOST, REDIS_PORT, REDIS_PASSWORD and REDIS_QUEUE_DB, and switch clients with REDIS_CLIENT=phpredis. CI runs both clients, because they disagree about key prefixing, variadic arguments and SCAN.

Contributing

See CONTRIBUTING.md. Security issues go through SECURITY.md, not the issue tracker.

License

MIT. See LICENSE.md.


All versions of laravel-queue-manager with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/console Version ^10.0|^11.0|^12.0
illuminate/contracts Version ^10.0|^11.0|^12.0
illuminate/queue Version ^10.0|^11.0|^12.0
illuminate/redis Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.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 alveby/laravel-queue-manager contains the following files

Loading the files please wait ...