Download the PHP package lpks/redis-queue without Composer

On this page you can find all versions of the php package lpks/redis-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 redis-queue

Install

Usage

Worker (Consumer)

Process messages from the queue:

Queue (Producer)

Push messages into the queue:

API Reference

Client class

Constructor

Methods

Method Description
push(string $name, array $data, int $retries = 3) Push a message to the queue, auto-retry on Redis error
loop(string $name, Worker $worker) Infinite loop processing messages, auto-reconnect on disconnection
stop() Stop the processing loop
enableGracefulShutdown() Catch SIGTERM/SIGINT to shut down safely (requires ext-pcntl)
setLogger(callable $logger) Inject a custom logger (e.g. function($msg) { echo $msg; })
setOnIdle(callable $onIdle) Called on every empty poll with the number of seconds idle so far; return true to stop the loop

Constants

Constant Default Description
Client::BLOCK_TIMEOUT 2 How long BLPOP waits for a message each poll
Client::READ_WRITE_TIMEOUT 5 Socket read timeout. Must be non-zero (otherwise a silently dead connection blocks forever) and greater than BLOCK_TIMEOUT (otherwise every poll times out). Override per instance via the read_write_timeout option.

Exiting when the queue is empty

A worker that blocks on BLPOP forever keeps its memory for as long as it runs. Use setOnIdle() to let the process exit once there is nothing left to do — useful when a supervisor (pm2, systemd) restarts it on demand:

The idle counter resets every time a message is processed.

Advanced example: Redis with password and custom logger

Message class

Method Description
$message->key Magic getter, returns value by key
$message->get(string $key, $default = null) Get value with a default fallback
$message->has(string $key): bool Check if a key exists
$message->toArray(): array Get all data as an array
isset($message->key) Check if a key exists

All versions of redis-queue with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
predis/predis Version ^1.1
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 lpks/redis-queue contains the following files

Loading the files please wait ...