PHPackages                             imliam/laravel-throttle-simultaneous-requests - 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. imliam/laravel-throttle-simultaneous-requests

ActiveLibrary[API Development](/categories/api)

imliam/laravel-throttle-simultaneous-requests
=============================================

Throttle the current user's requests based on how many requests are currently being executed.

v2.1.0(1y ago)4623.0k↓62.5%7[1 issues](https://github.com/ImLiam/laravel-throttle-simultaneous-requests/issues)[1 PRs](https://github.com/ImLiam/laravel-throttle-simultaneous-requests/pulls)MITPHPPHP ^8.0

Since Jul 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ImLiam/laravel-throttle-simultaneous-requests)[ Packagist](https://packagist.org/packages/imliam/laravel-throttle-simultaneous-requests)[ Docs](https://github.com/imliam/laravel-throttle-simultaneous-requests)[ GitHub Sponsors](https://github.com/imliam)[ RSS](/packages/imliam-laravel-throttle-simultaneous-requests/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)Dependencies (5)Versions (6)Used By (0)

Laravel Throttle Simultaneous Requests Middleware
=================================================

[](#laravel-throttle-simultaneous-requests-middleware)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ebb4d3adff20602f349aacdbe154f5b3c1b86d117c02bc57e35c5492e9709a2a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696d6c69616d2f6c61726176656c2d7468726f74746c652d73696d756c74616e656f75732d72657175657374732e737667)](https://packagist.org/packages/imliam/laravel-throttle-simultaneous-requests)[![Total Downloads](https://camo.githubusercontent.com/f48edeeb4d49046b4c42adb39461e6daab9526394e950977448d16355ba9fbc4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696d6c69616d2f6c61726176656c2d7468726f74746c652d73696d756c74616e656f75732d72657175657374732e737667)](https://packagist.org/packages/imliam/laravel-throttle-simultaneous-requests)[![License](https://camo.githubusercontent.com/912271b7a379133627334e9f2e5635cd9719e51a5a6c181f063500fc79448c68/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f696d6c69616d2f6c61726176656c2d7468726f74746c652d73696d756c74616e656f75732d72657175657374732e737667)](LICENSE.md)

Throttle the current user's requests based on how many requests are currently being executed, in case any are time consuming before giving a response.

This helps when some endpoints are more resource-intensive than others, and stops users from retrying requests that may not have even completed yet.

This forces users of your API to interact in a different way by queuing their requests appropriately instead of spamming until they reach the request limit.

When performing an action only the current user can perform, this also helps to ensure that the endpoint has a form of *idempotency* and any side effects can only occur once until a subsequent request is made.

- [Laravel Throttle Simultaneous Requests Middleware](#laravel-throttle-simultaneous-requests-middleware)
    - [Installation](#installation)
    - [Usage](#usage)
        - [Why not use queues?](#why-not-use-queues)
        - [Why is no `Retry-After` header sent?](#why-is-no-retry-after-header-sent)
    - [Testing](#testing)
    - [Changelog](#changelog)
    - [Contributing](#contributing)
        - [Security](#security)
    - [Credits](#credits)
    - [License](#license)

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

[](#installation)

You can install the package with [Composer](https://getcomposer.org/) using the following command:

```
composer require imliam/laravel-throttle-simultaneous-requests:^2.0.0
```

Once installed to your project, add the middleware to your `App\Http\Kernel::$routeMiddleware` array.

```
protected $routeMiddleware = [
    // ...
    'simultaneous' => \ImLiam\ThrottleSimultaneousRequests\ThrottleSimultaneousRequests::class,
];
```

Usage
-----

[](#usage)

You can use the middleware like any other. For example, to limit a particular endpoint to only 3 concurrent requests by the same user:

```
Route::get('/', 'HomeController@index')->middleware('simultaneous:3');
```

### Why not use queues?

[](#why-not-use-queues)

Queues have their place to defer time consuming tasks to a later date, however they are not always the most appropriate solution for a task. A given task could require use of limited hardware resources, or require some other kind of processing that does not make sense to run concurrently.

[See how Stripe use concurrent request limiters...](https://stripe.com/blog/rate-limiters)

### Why is no `Retry-After` header sent?

[](#why-is-no-retry-after-header-sent)

Most typical rate limiting solutions limit a user to a number of requests within a set time period, such as 100 requests per minute, so include a `Retry-After` header to let the requestor know when they are available to try again.

This middleware does not add such a header to the response, due to the nature of the request taking a longer amount of time to complete there is no guaranteed time where the requestor can retry the request. Instead, it is up to the requestor to determine when to retry.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Liam Hammett](https://github.com/imliam)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

44

—

FairBetter than 91% of packages

Maintenance41

Moderate activity, may be stable

Popularity36

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity72

Established project with proven stability

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

Total

3

Last Release

474d ago

Major Versions

v1.0.0 → v2.0.02020-09-13

PHP version history (3 changes)v1.0.0PHP ^7.1

v2.0.0PHP ^7.3

v2.1.0PHP ^8.0

### Community

Maintainers

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

---

Top Contributors

[![imliam](https://avatars.githubusercontent.com/u/4326337?v=4)](https://github.com/imliam "imliam (8 commits)")

---

Tags

middlewareapilaravelthrottleimliamlaravel-throttle-simultaneous-requests

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/imliam-laravel-throttle-simultaneous-requests/health.svg)

```
[![Health](https://phpackages.com/badges/imliam-laravel-throttle-simultaneous-requests/health.svg)](https://phpackages.com/packages/imliam-laravel-throttle-simultaneous-requests)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[resend/resend-laravel

Resend for Laravel

1212.2M8](/packages/resend-resend-laravel)[essa/api-tool-kit

set of tools to build an api with laravel

53386.5k](/packages/essa-api-tool-kit)[api-platform/laravel

API Platform support for Laravel

59156.3k11](/packages/api-platform-laravel)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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