PHPackages                             arubacao/aws-ip-range-middleware - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. arubacao/aws-ip-range-middleware

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

arubacao/aws-ip-range-middleware
================================

Laravel Middleware for Amazon Web Services (AWS) IP Address Range

v1.3.0(3w ago)172.3k[1 issues](https://github.com/arubacao/aws-ip-range-middleware/issues)MITPHPPHP ^8.1CI passing

Since Feb 15Pushed 3w ago1 watchersCompare

[ Source](https://github.com/arubacao/aws-ip-range-middleware)[ Packagist](https://packagist.org/packages/arubacao/aws-ip-range-middleware)[ Docs](https://github.com/arubacao/aws-ip-range-middleware)[ RSS](/packages/arubacao-aws-ip-range-middleware/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (3)Dependencies (14)Versions (7)Used By (0)

Laravel Middleware for Amazon Web Services (AWS) IP Address Range Validation
============================================================================

[](#laravel-middleware-for-amazon-web-services-aws-ip-address-range-validation)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a2ac859e5f68742cdd77042e8513fad782e0e6fbbd628046429e698ffbcece2a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617275626163616f2f6177732d69702d72616e67652d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/arubacao/aws-ip-range-middleware)[![Run Tests](https://github.com/arubacao/aws-ip-range-middleware/workflows/Run%20Tests/badge.svg)](https://github.com/arubacao/aws-ip-range-middleware/actions?query=workflow%3A%22Run+Tests%22)[![Total Downloads](https://camo.githubusercontent.com/7050f4447790496dfb68ce080ffa45fb966b32fd933fcb5a46ea4c4e7e1b556b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f617275626163616f2f6177732d69702d72616e67652d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/arubacao/aws-ip-range-middleware)

This package allows for **validation** of incoming **requests** against the official [Amazon Web Services (AWS) IP Address Range](https://docs.aws.amazon.com/general/latest/gr/aws-ip-ranges.html). Use this to determine if an incoming request actually comes from the AWS infrastructure e.g. for [Simple Notification Service (SNS)](https://docs.aws.amazon.com/sns/latest/dg/welcome.html) payloads.

Features
--------

[](#features)

- Passes incoming HTTP requests from AWS, rejects everything else with a `403`.
- AWS *IP address range* is fetched on demand and therefore always up-to-date.
- Caches the parsed *IP address range* (default: 24 hours).
- Source URL, cache key, and TTL are configurable.

Supported versions
------------------

[](#supported-versions)

Actively tested in CI:

PHPLaravel`8.1``9.*`, `10.*``8.2``10.*`, `11.*``8.3``11.*`, `12.*``8.4``11.*`, `12.*`This package requires PHP `8.1+` and Laravel `9+`.

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

[](#installation)

Install this package via composer:

```
composer require arubacao/aws-ip-range-middleware
```

Laravel registers the service provider automatically via package discovery. If package discovery is disabled, add the provider manually in `config/app.php`:

```
'providers' => [
    // ...
    Arubacao\AwsIpRange\AwsIpRangeServiceProvider::class,
],
```

### Registering the middleware

[](#registering-the-middleware)

Assign the middleware a key in your `app/Http/Kernel.php`:

```
// Within App\Http\Kernel...

protected $routeMiddleware = [
    // ...
    'aws-ip-range' => \Arubacao\AwsIpRange\AwsIpRangeMiddleware::class,
];
```

Usage
-----

[](#usage)

```
Route::post('api/sns', function () {
    //
})->middleware('aws-ip-range');
```

You can also pass the fully qualified class name (no Kernel registration required):

```
use Arubacao\AwsIpRange\AwsIpRangeMiddleware;

Route::post('api/sns', function () {
    //
})->middleware(AwsIpRangeMiddleware::class);
```

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

[](#configuration)

Publish the config file to override the defaults:

```
php artisan vendor:publish --provider="Arubacao\AwsIpRange\AwsIpRangeServiceProvider" --tag=config
```

This creates `config/aws-ip-range.php`:

```
return [
    'url'       => env('AWS_IP_RANGE_URL', 'https://ip-ranges.amazonaws.com/ip-ranges.json'),
    'cache_key' => env('AWS_IP_RANGE_CACHE_KEY', 'arubacao_aws-ip-ranges'),
    'cache_ttl' => (int) env('AWS_IP_RANGE_CACHE_TTL', 86400),
];
```

Testing
-------

[](#testing)

```
composer test
```

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Christopher Lass](https://github.com/arubacao)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

56

—

FairBetter than 97% of packages

Maintenance93

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 96.7% 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 ~757 days

Total

5

Last Release

25d ago

PHP version history (3 changes)1.0.0PHP ^7.0

1.0.2PHP ^7.0|^8.0

v1.2.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7462542?v=4)[Christopher Lass](/maintainers/arubacao)[@arubacao](https://github.com/arubacao)

---

Top Contributors

[![arubacao](https://avatars.githubusercontent.com/u/7462542?v=4)](https://github.com/arubacao "arubacao (29 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

awsipip-rangeslaravelmiddlewaremiddlewarelaravelawsip range

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/arubacao-aws-ip-range-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/arubacao-aws-ip-range-middleware/health.svg)](https://phpackages.com/packages/arubacao-aws-ip-range-middleware)
```

###  Alternatives

[spatie/laravel-export

Create a static site bundle from a Laravel app

672139.5k6](/packages/spatie-laravel-export)[illuminate/http

The Illuminate Http package.

11937.2M6.6k](/packages/illuminate-http)[moonshine/moonshine

Laravel administration panel

1.3k239.9k76](/packages/moonshine-moonshine)[venturedrake/laravel-crm

A free open source CRM built as a package for laravel projects

42010.0k](/packages/venturedrake-laravel-crm)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[flarum/core

Delightfully simple forum software.

201.4M2.2k](/packages/flarum-core)

PHPackages © 2026

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