Download the PHP package kartubi/php-redis-rate without Composer

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

PHP Redis Rate Limiter

A modern Laravel package for Redis-based rate limiting using the GCRA (Generic Cell Rate Algorithm) algorithm. Built for Laravel 10+ with PHP 8.1+ features. Inspired by and compatible with the go-redis/redis_rate library.

Looking for legacy Laravel support? Check out the v1.x branch for Laravel 5.5-9.x compatibility.

Features

Installation

Install the package via Composer:

For legacy Laravel projects (5.5-9.x): Use composer require kartubi/php-redis-rate:^1.0 instead.

The package will automatically register itself via Laravel's package discovery.

Publish the configuration file (optional):

Clean Redis Keys Setup (Recommended)

By default, Laravel adds an app-name prefix to Redis keys (e.g., laravel-app-database-rate:user123). For cleaner rate limiting keys, run the setup command:

This command will:

You can also specify a custom database number:

Environment Configuration

After running setup, you can optionally configure these environment variables:

Docker Configuration

For Docker environments, add these environment variables to your docker-compose.yml:

The setup command will run automatically in your Dockerfile:

Requirements

Basic Usage

Using the Facade

Using Dependency Injection

Rate Limit Types

Pre-defined Limits

Custom Limits

Advanced Usage

Multiple Requests

Reset Rate Limits

Middleware Usage

Add the middleware to your HTTP kernel or use it directly in routes:

Register Middleware

In your app/Http/Kernel.php:

Configuration

The configuration file allows you to customize default settings:

Testing Commands

Test your rate limiting configuration:

Understanding Results

The Result object contains important information about the rate limiting decision:

Algorithm Details

This package implements the GCRA (Generic Cell Rate Algorithm), also known as the leaky bucket algorithm. GCRA provides several advantages:

Version Compatibility

Package Version Laravel Version PHP Version Branch
3.x (Current) 10.x, 11.x, 12.x 8.1+ main
1.x (Legacy) 5.5, 6.x, 7.x, 8.x, 9.x 7.2+ v1.x

Note: This is the modern v3.x version. For legacy Laravel support, see the v1.x branch documentation.

Testing

Run the test suite:

Run tests with coverage:

License

This package is open-sourced software licensed under the MIT license.

Credits

This package is inspired by the excellent go-redis/redis_rate library and implements the same GCRA algorithm for PHP/Laravel applications.


All versions of php-redis-rate with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/redis Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.0
predis/predis Version ^2.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 kartubi/php-redis-rate contains the following files

Loading the files please wait ...