PHPackages                             oussema-khlifi/api-rate-limiter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. oussema-khlifi/api-rate-limiter

ActiveLibrary[API Development](/categories/api)

oussema-khlifi/api-rate-limiter
===============================

API RATE LIMITER is a package that provides a middelware for laravel applications to enforce rate limiting on incoming API requests using the Token Bucket Algorithm, it helps to prevent abuse of API resources and ensures fair access to the API for all users

10PHP

Since Jul 23Pushed 2y ago1 watchersCompare

[ Source](https://github.com/oussemakh1/api-rate-limiter-package)[ Packagist](https://packagist.org/packages/oussema-khlifi/api-rate-limiter)[ RSS](/packages/oussema-khlifi-api-rate-limiter/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

API Rate Limiter Package for Laravel
====================================

[](#api-rate-limiter-package-for-laravel)

The API Rate Limiter package provides a middleware for Laravel applications to implement rate limiting on incoming API requests using the Token Bucket Algorithm. Rate limiting helps prevent abuse of API resources and ensures fair access to the API for all users.

Features
--------

[](#features)

- **Token Bucket Algorithm:** Efficiently controls the rate of incoming API requests per user.
- **Customizable Rate Limits:** Set tokens generated per minute and maximum tokens allowed per user.
- **Middleware Integration:** Apply rate limiting to specific API routes or globally using the middleware.
- **Lightweight and Easy to Use:** Simple integration with Laravel applications.

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require oussema-khlifi/api-rate-limiter
```

Usage
-----

[](#usage)

Import the ApiRateLimiterMiddleware in your App\\Http\\Kernel.php file. Apply the middleware to specific API routes or globally in the middleware stack.

```
use OussemaKhlifi\ApiRateLimiter\Middleware\ApiRateLimiterMiddleware;

protected $middlewareGroups = [
    'api' => [
        // Other middleware...
        ApiRateLimiterMiddleware::class,
    ],
];
```

Configuration
-------------

[](#configuration)

The default rate limiting settings can be modified in the `config/api_rate_limiter.php` configuration file:

```
return [
    'tokens_per_minute' => 60,
    'max_tokens' => 60,
];
```

License
-------

[](#license)

This package is open-source software licensed under the MIT License.

Support
-------

[](#support)

If you encounter any issues or have questions, please open an issue.

Contribution
------------

[](#contribution)

Contributions are welcome! If you wish to contribute, please fork the repository, create a new branch, and submit a pull request.

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/46871935?v=4)[Oussema Khlifi](/maintainers/oussemakh1)[@oussemakh1](https://github.com/oussemakh1)

---

Top Contributors

[![oussemakh1](https://avatars.githubusercontent.com/u/46871935?v=4)](https://github.com/oussemakh1 "oussemakh1 (15 commits)")

### Embed Badge

![Health badge](/badges/oussema-khlifi-api-rate-limiter/health.svg)

```
[![Health](https://phpackages.com/badges/oussema-khlifi-api-rate-limiter/health.svg)](https://phpackages.com/packages/oussema-khlifi-api-rate-limiter)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
