Download the PHP package bhamner/laravel-redis-streams without Composer

On this page you can find all versions of the php package bhamner/laravel-redis-streams. 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-redis-streams

Laravel Redis Streams

A Composer package for Redis Streams consumer groups. create() appends an entry. A group delivers each new entry to one consumer, and the entry stays pending until that consumer calls ack().

Laravel's Redis connection already forwards the raw commands (XADD, XREADGROUP, XACK, XAUTOCLAIM, and the rest). This package is the fluent layer on top of them. It works with both the PhpRedis extension and Predis, and it keeps your configured Redis key prefix.

Install

The package is on Packagist.

Laravel discovers the service provider. Publish the config if you want to change the connection or worker defaults:

The package uses the Redis connection named in REDIS_STREAM_CONNECTION (default when unset).

Append entries

A stream class sets the Redis key:

add() accepts maxLength when the stream should be trimmed as it grows:

Typed events

dispatch() stores the class name and its public properties on the stream:

Consumer groups

Each new entry is delivered to one consumer in the group. It stays in the pending list until ack(). Another consumer can claim it with claimIdle() after the idle time has passed.

pop() and read() create the group the first time (XGROUP CREATE ... MKSTREAM), starting at $ so only new entries are delivered. Pass ensure('0') when this group should start from the beginning of the stream.

Pending work and idle claims:

A worker

Extend Consumer and run it with redis-streams:work. The command claims entries that have been pending longer than claim_after, reads new ones, calls handle, and acknowledges on success. An exception leaves the entry pending. After max_deliveries (default 5) the worker calls failed() and acknowledges the entry.

SIGTERM and SIGINT stop the loop when the pcntl extension is loaded.

Defaults

Config Env Default
connection REDIS_STREAM_CONNECTION default
block REDIS_STREAM_BLOCK 2000 milliseconds
count REDIS_STREAM_COUNT 10
claim_after REDIS_STREAM_CLAIM_AFTER 60000 milliseconds
max_deliveries REDIS_STREAM_MAX_DELIVERIES 5

Override any of those on the consumer class with $block, $count, $claimAfter, $maxDeliveries, or $start.

Contributing

Bug reports and pull requests are welcome on GitHub.

Open an issue for a bug. Include the Laravel and Redis versions, whether you use PhpRedis or Predis, and the smallest snippet that shows the failure.

To send a change:

  1. Fork the repository and create a branch.
  2. Add or update a test when the change affects behavior.
  3. Run vendor/bin/phpunit. The suite needs PHP 8.2 or newer.
  4. Open a pull request against main and describe what the change does.

All versions of laravel-redis-streams with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/console Version ^11.0|^12.0|^13.0
illuminate/redis Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.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 bhamner/laravel-redis-streams contains the following files

Loading the files please wait ...