Download the PHP package anjola/php_rate_limiter without Composer

On this page you can find all versions of the php package anjola/php_rate_limiter. 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_rate_limiter

PHP Rate Limiter

A PHP Library that seamlessly integrates rate limiting into your platform. It supports multiple storage backends including Redis, File System, and SQL Relational Databases, providing flexible and efficient request limiting capabilities.


Table of Contents


Introduction

The PHP Rate Limiter library provides a simple and extensible way to limit the number of requests or actions a user or system can perform within a specified time window. It supports multiple storage backends to suit different environments and scales, including Redis, file-based storage, SQL databases, and session storage.

Additionally, the library includes an Analytics component to track custom events, allowing you to monitor usage patterns or other metrics alongside rate limiting.


Installation

You can install the library via Composer:

Requirements


Configuration

The library uses environment variables to configure storage options. You can create a .env file in your project root to set these variables.

Important Environment Variables

Variable Description Default
STORAGE_DRIVER Storage backend to use (redis, file, database, session) sqlite (file-based)
ANALYTICS_STORAGE_FILE_NAME File name for analytics storage when using file driver analytics_storage.json
RATELIMITER_STORAGE_FILE_NAME File name for rate limiter storage when using file driver ratelimiter_storage.json

Make sure to configure your environment according to your preferred storage backend.


Usage

RateLimiter

The RateLimiter class allows you to limit the number of attempts for a given key within a decay period.

Initialization

Check if too many attempts

Clear records for a key


Analytics

The Analytics class allows you to track custom events and retrieve their counts.

Initialization

Track an event

Get event count

Reset event count


Storage Options

The library supports multiple storage backends to store rate limiting and analytics data. You can configure the storage driver via the STORAGE_DRIVER environment variable.

Supported Drivers

Configuration Example

Set the storage driver in your .env file:

Or for file storage:


Examples

Basic Rate Limiting Example

Analytics Tracking Example


License

This project is licensed under the Apache-2.0 License. See the LICENSE file for details.


Author

Anjolaanuoluwapo
Email: [email protected]


Thank you for using PHP Rate Limiter! If you have any questions or issues, feel free to open an issue or contact the author.


All versions of php_rate_limiter with dependencies

PHP Build Version
Package Version
Requires vlucas/phpdotenv Version ^5.6
predis/predis Version ^2.3
ext-fileinfo Version *
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 anjola/php_rate_limiter contains the following files

Loading the files please wait ....