PHPackages                             oltrematica/laravel-ratelimiter - 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. oltrematica/laravel-ratelimiter

ActiveLibrary

oltrematica/laravel-ratelimiter
===============================

a lightweight Laravel package that provides simple role management functionality.

v1.1.0(1mo ago)22.5k↑700%[4 PRs](https://github.com/Oltrematica/laravel-rate-limiter/pulls)MITPHPPHP ^8.3CI passing

Since Mar 7Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Oltrematica/laravel-rate-limiter)[ Packagist](https://packagist.org/packages/oltrematica/laravel-ratelimiter)[ RSS](/packages/oltrematica-laravel-ratelimiter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (24)Versions (8)Used By (0)

[![GitHub Tests Action Status](https://github.com/Oltrematica/laravel-rate-limiter/actions/workflows/run-tests.yml/badge.svg)](https://github.com/Oltrematica/laravel-rate-limiter/actions/workflows/run-tests.yml/badge.svg)[![GitHub PhpStan Action Status](https://github.com/Oltrematica/laravel-rate-limiter/actions/workflows/phpstan.yml/badge.svg)](https://github.com/Oltrematica/laravel-rate-limiter/actions/workflows/phpstan.yml/badge.svg)[![Latest Version on Packagist](https://camo.githubusercontent.com/65a1e7b2483c80f001481a5fb80b116447d562eb9d42ea1e52ae299fe8fb9e2c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6c7472656d61746963612f6c61726176656c2d726174656c696d697465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oltrematica/laravel-ratelimiter)[![Total Downloads](https://camo.githubusercontent.com/d5c6da2b3a863283ed16583b727f014cb7c85ce7ed05c4fc7fe4ba7d906a3d09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6c7472656d61746963612f6c61726176656c2d726174656c696d697465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oltrematica/laravel-ratelimiter)

Oltrematica API Rate Limiter
============================

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

A Laravel package to manage rate limiters for APIs, used internally at Oltrematica for our projects.

Introduction
------------

[](#introduction)

This package provides a simple configuration for rate limiters in APIs, allowing easy management of requests for login, registration, and general API routes. It is designed to be straightforward to integrate and configure within Laravel projects.

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

[](#installation)

To install the package, run the following command in your terminal:

```
composer require oltrematica/laravel-rate-limiter
```

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

[](#configuration)

The package includes a configuration file that can be customized. To publish the configuration file to your project, run the following command:

```
php artisan vendor:publish --provider="Oltrematica\RateLimiter\RateLimiterServiceProvider" --tag="ratelimiter-config"
```

This will publish the `rate-limiter.php` configuration file into your project's `config` directory.

Usage
-----

[](#usage)

To apply rate limiters, use the following middleware in your routes:

- **API Rate Limiter**: Use the `throttle:api` middleware to apply rate limiting to API requests.
- **Login Rate Limiter**: Use the `throttle:login` middleware to apply rate limiting to login requests.
- **Register Rate Limiter**: Use the `throttle:register` middleware to apply rate limiting to registration requests.

### Examples

[](#examples)

#### Applying Rate Limiting to API Routes

[](#applying-rate-limiting-to-api-routes)

In `routes/api.php`:

```
Route::middleware(['throttle:api'])->group(function () {
// API routes go here
});
```

#### Applying Rate Limiting to Login Route

[](#applying-rate-limiting-to-login-route)

In `routes/web.php`:

```
Route::post('/login', 'LoginController@login')->middleware('throttle:login');
```

#### Applying Rate Limiting to Registration Route

[](#applying-rate-limiting-to-registration-route)

In `routes/web.php`:

```
Route::post('/register', 'RegisterController@register')->middleware('throttle:register');
```

Configuration Options
---------------------

[](#configuration-options)

The `rate-limiter.php` configuration file allows you to customize request limits for each type of rate limiter. You can override default values using environment variables in your `.env` file.

### Example `.env` Variables

[](#example-env-variables)

```
RATE_LIMITING_API_IGNORE_ADMINS=true
RATE_LIMITING_API_LIMIT=60
RATE_LIMITING_API_LOGIN_LIMIT=60
RATE_LIMITING_API_LOGIN_LIMIT_PER_EMAIL=10
RATE_LIMITING_API_REGISTER_LIMIT=60
```

Code Quality
------------

[](#code-quality)

The project includes automated tests and tools for code quality control.

### Rector

[](#rector)

Rector is a tool for automating code refactoring and migrations. It can be run using the following command:

```
composer refactor
```

### PhpStan

[](#phpstan)

PhpStan is a tool for static analysis of PHP code. It can be run using the following command:

```
composer analyse
```

### Pint

[](#pint)

Pint is a tool for formatting PHP code. It can be run using the following command:

```
composer format
```

### Automated Tests

[](#automated-tests)

The project includes automated tests and tools for code quality control.

```
composer test
```

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

[](#contributing)

Feel free to contribute to this package by submitting issues or pull requests. We welcome any improvements or bug fixes you may have.

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance90

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~192 days

Total

3

Last Release

52d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d83b7839d47e1a6d48da2b5b7633acfc48b3aed4bfc52c55d15be859757eb04?d=identicon)[oltrematica](/maintainers/oltrematica)

---

Top Contributors

[![mirchaemanuel](https://avatars.githubusercontent.com/u/1971953?v=4)](https://github.com/mirchaemanuel "mirchaemanuel (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")[![u-alexandru](https://avatars.githubusercontent.com/u/65723080?v=4)](https://github.com/u-alexandru "u-alexandru (1 commits)")

---

Tags

laravelrate-limiteroltrematicaapi throttling

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/oltrematica-laravel-ratelimiter/health.svg)

```
[![Health](https://phpackages.com/badges/oltrematica-laravel-ratelimiter/health.svg)](https://phpackages.com/packages/oltrematica-laravel-ratelimiter)
```

###  Alternatives

[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[basillangevin/laravel-data-json-schemas

Transforms Spatie Data objects into JSON Schemas with built-in validation

1312.2k1](/packages/basillangevin-laravel-data-json-schemas)

PHPackages © 2026

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