PHPackages                             avnsh1111/laravel-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. avnsh1111/laravel-api-rate-limiter

ActiveLibrary[API Development](/categories/api)

avnsh1111/laravel-api-rate-limiter
==================================

Laravel API Rate Limiter is an open-source package designed to help developers easily implement and manage rate limiting for their API endpoints in Laravel applications. This package aims to provide a flexible and configurable solution for protecting APIs from excessive requests, ensuring optimal performance and preventing abuse.

v1(3y ago)628MITPHPPHP ^7.3|^8.0|^8.2

Since Apr 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Avnsh1111/laravel-api-rate-limiter)[ Packagist](https://packagist.org/packages/avnsh1111/laravel-api-rate-limiter)[ RSS](/packages/avnsh1111-laravel-api-rate-limiter/feed)WikiDiscussions 1.1.0 Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

Laravel API Rate Limiter
========================

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

Laravel API Rate Limiter is an open-source package designed to help developers easily implement and manage rate limiting for their API endpoints in Laravel applications. This package aims to provide a flexible and configurable solution for protecting APIs from excessive requests, ensuring optimal performance and preventing abuse.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [Add-ons](#add-ons)
- [Support](#support)
- [Contributing](#contributing)
- [License](#license)

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

[](#installation)

You can install the package via composer:

```
composer require avnsh1111/laravel-api-rate-limiter
```

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

[](#configuration)

Before publishing the configuration file, you need to add the `LaravelApiRateLimiterServiceProvider` to the `providers` array in your `config/app.php`:

```
'providers' => [
    // ...
    Avnsh1111\LaravelApiRateLimiter\LaravelApiRateLimiterServiceProvider::class,
],
```

After adding the ServiceProvider, publish the configuration file to configure the rate limiting settings:

```
php artisan vendor:publish --provider="Avnsh1111\LaravelApiRateLimiter\LaravelApiRateLimiterServiceProvider"
```

This will create a `laravel-api-rate-limiter.php` configuration file in your `config` folder.

In the configuration file, you can set the default rate limit, rate limiting method, response headers, and whitelist/blacklist specific IP addresses, users, and routes.

```
return [
    'default_limit' => 60, // default number of requests allowed per minute

    'rate_limit_by' => 'ip', // rate limit by 'ip', 'user', or 'route'

    'response_headers' => true, // include rate limit headers in responses

    'whitelist' => [
        'ips' => [], // IP addresses to whitelist
        'users' => [], // User IDs to whitelist
        'routes' => [], // Route names to whitelist
    ],
    'blacklist' => [
        'ips' => [], // IP addresses to blacklist
        'users' => [], // User IDs to blacklist
        'routes' => [], // Route names to blacklist
    ],

];
```

Usage
-----

[](#usage)

To apply rate limiting to specific routes or route groups, use the provided middleware:

```
use Avnsh1111\LaravelApiRateLimiter\Middleware\RateLimiter;

Route::middleware([RateLimiter::class])->group(function () {
    Route::get('/api/endpoint', 'ApiController@index');
});
```

You can also customize the rate limit for specific routes by passing the limit as an argument to the middleware:

```
Route::get('/api/endpoint', 'ApiController@index')->middleware(RateLimiter::class . ':100'); // 100 requests per minute
```

Add-ons
-------

[](#add-ons)

1. Integration with Laravel's built-in caching system to store and manage rate limiting data efficiently.
2. A user-friendly dashboard for monitoring rate limiting statistics, such as the number of requests, blocked requests, and whitelisted/blacklisted IPs or users.
3. Support for automatically adjusting rate limits based on server load or other performance metrics.
4. Integration with popular third-party API management and monitoring tools, such as Postman or Swagger, to provide additional insights and control over API usage.

Support
-------

[](#support)

If you encounter any issues or require assistance, please check the comprehensive documentation or reach out to the community through the issue tracker on GitHub.

Contributing
------------

[](#contributing)

Contributions are welcome! If you would like to contribute to the project, please fork the repository, make your changes, and submit a pull request. Be sure to follow the coding standards and provide tests for any new features or bug fixes.

License
-------

[](#license)

The Laravel API Rate Limiter package is open-source software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

1114d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bfd56d41bd712cdc62cd3346237f547a5c600680138a612a0707efcec3d3a003?d=identicon)[avnsh1111](/maintainers/avnsh1111)

---

Top Contributors

[![Avnsh1111](https://avatars.githubusercontent.com/u/28943172?v=4)](https://github.com/Avnsh1111 "Avnsh1111 (32 commits)")

---

Tags

apiapi-restlaravellaravel-api-rate-limiterlaravel10middlewarerate-limiter

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3624.1M28](/packages/mollie-laravel-mollie)[mll-lab/laravel-graphiql

Easily integrate GraphiQL into your Laravel project

683.2M9](/packages/mll-lab-laravel-graphiql)[spatie/laravel-route-discovery

Auto register routes using PHP attributes

23645.0k2](/packages/spatie-laravel-route-discovery)[esign/laravel-conversions-api

A laravel wrapper package around the Facebook Conversions API

69145.4k](/packages/esign-laravel-conversions-api)[didww/didww-api-3-php-sdk

PHP SDK for DIDWW API 3

1218.2k](/packages/didww-didww-api-3-php-sdk)[surface/laravel-webfinger

A Laravel package to create an ActivityPub webfinger.

113.8k](/packages/surface-laravel-webfinger)

PHPackages © 2026

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