PHPackages                             midnite81/guardian - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. midnite81/guardian

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

midnite81/guardian
==================

Guardian is a PHP package that provides a way to wrap HTTP requests so they don't exceed Rate Limiting rules and controls Error Handling

v1.0.3(1y ago)02MITPHPPHP &gt;8.2

Since Oct 6Pushed 1y ago1 watchersCompare

[ Source](https://github.com/midnite81/guardian)[ Packagist](https://packagist.org/packages/midnite81/guardian)[ RSS](/packages/midnite81-guardian/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (10)Versions (5)Used By (0)

Guardian
========

[](#guardian)

Guardian is a powerful and flexible rate limiting and error handling library for PHP applications. It provides a robust system for managing API rate limits, preventing abuse, and handling errors gracefully. Guardian can be used in any PHP project and has built-in support for Laravel applications. Full documentation: [guardian.midnite.uk](https://guardian.midnite.uk)

Requirements
------------

[](#requirements)

- PHP 8.2 or higher

Key Features
------------

[](#key-features)

- Flexible rate limiting rules
- Configurable error handling
- Multiple cache drivers (File, Redis, Laravel)
- Ability to add custom drivers
- Easy integration with Laravel
- Customizable for any PHP project

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

[](#installation)

Install Guardian via Composer:

```
composer require midnite81/guardian
```

Quick Start
-----------

[](#quick-start)

```
use Midnite81\Guardian\Factories\GuardianFactory;
use Midnite81\Guardian\Store\FileStore;
use Midnite81\Guardian\Rules\RateLimitRule;

$guardian = GuardianFactory::create(
    'my-api',
    new FileStore('/path/to/cache'),
    [RateLimitRule::allow(100)->perMinute()]
);

$result = $guardian->send(function() {
    // Your API logic here
});
```

Documentation
-------------

[](#documentation)

For detailed usage instructions, API reference, and advanced configuration options, please refer to the official Guardian documentation:

Future plans for Guardian
-------------------------

[](#future-plans-for-guardian)

As of October 2024, Guardian has just been released and there is no roadmap as such for it as yet. Its use in the wild might bring in required features.

Some initial thoughts:

- More integration for Laravel, but introducing a config file to make getting instances more easily
- Adding in a way to work with PSR-7, PSR-18, PSR-17, and PSR-15

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

[](#contributing)

Contributions are welcome! Please see our [Contributing Guide](CONTRIBUTING.md) for more details.

License
-------

[](#license)

Guardian is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

4

Last Release

588d ago

### Community

Maintainers

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

---

Top Contributors

[![midnite81](https://avatars.githubusercontent.com/u/254850?v=4)](https://github.com/midnite81 "midnite81 (59 commits)")

---

Tags

error-handlinghttp-requestsrate-limiting

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/midnite81-guardian/health.svg)

```
[![Health](https://phpackages.com/badges/midnite81-guardian/health.svg)](https://phpackages.com/packages/midnite81-guardian)
```

###  Alternatives

[symfony/stopwatch

Provides a way to profile code

2.8k387.2M918](/packages/symfony-stopwatch)[fruitcake/laravel-debugbar

PHP Debugbar integration for Laravel

19.1k662.9k29](/packages/fruitcake-laravel-debugbar)[jokkedk/webgrind

Webgrind is a Xdebug profiling web frontend in PHP5. It implements a subset of the features of kcachegrind and installs in seconds and works on all platforms. For quick'n'dirty optimizations it does the job.

3.3k193.0k](/packages/jokkedk-webgrind)[koriym/printo

An object graph visualizer.

1421.8M2](/packages/koriym-printo)[soloterm/dumps

A Laravel command to intercept dumps from your Laravel application.

125285.7k3](/packages/soloterm-dumps)[beyondcode/helo-laravel

HELO Laravel debug helper

90360.1k](/packages/beyondcode-helo-laravel)

PHPackages © 2026

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