PHPackages                             marshmallow/ip-access - 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. marshmallow/ip-access

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

marshmallow/ip-access
=====================

Marshmallow - Laravel IP Access

v2.7.0(3mo ago)111.5k↓70.7%1MITPHPPHP ^8.0CI passing

Since Jan 22Pushed 3w ago1 watchersCompare

[ Source](https://github.com/marshmallow-packages/ip-access)[ Packagist](https://packagist.org/packages/marshmallow/ip-access)[ Docs](https://github.com/marshmallow/ip-access)[ RSS](/packages/marshmallow-ip-access/feed)WikiDiscussions main Synced yesterday

READMEChangelog (10)Dependencies (12)Versions (28)Used By (0)

Marshmallow - Laravel IP Access
===============================

[](#marshmallow---laravel-ip-access)

[![marshmallow.](https://camo.githubusercontent.com/f5450f299f5713ce2f04dd5a1ba7ce9960ed4568b3574e4c4ee3cddc75477253/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f6d656469612f6c6f676f2d7265642d3233377834362e706e67 "marshmallow.")](https://marshmallow.dev)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8387183d9075c9237b66025db0fac48cfe559755d6313a4c354b9d71f980eed9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617273686d616c6c6f772f69702d6163636573732e737667)](https://packagist.org/packages/marshmallow/ip-access)[![Total Downloads](https://camo.githubusercontent.com/4d521d3b62cc7499f7008295c76665cb23e2b195e5518b06be32bd37550f1125/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d617273686d616c6c6f772f69702d6163636573732e737667)](https://packagist.org/packages/marshmallow/ip-access)[![License](https://camo.githubusercontent.com/14a71af47ce66acd78c166eb66219251b37f3d53d9f9ed6ea316002cc3e48ec6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d617273686d616c6c6f772f69702d6163636573732e737667)](https://gitlab.com/marshmallowdev)[![Stars](https://camo.githubusercontent.com/21ec0a549fed88c8ff57f61e011baff9e7fba0d8bfa1a43221fb5e72da2d59e6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6d617273686d616c6c6f772d7061636b616765732f69702d6163636573733f636f6c6f723d79656c6c6f77267374796c653d706c6173746963)](https://github.com/marshmallow-packages/ip-access)[![Forks](https://camo.githubusercontent.com/af511a48d327e7afb56eb7b073bcae7b2d39eab924cfb1b34e6b68f29186d4df/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6d617273686d616c6c6f772d7061636b616765732f69702d6163636573733f636f6c6f723d627269676874677265656e267374796c653d706c6173746963)](https://github.com/marshmallow-packages/ip-access)

This a IP Access redirect package for IPv4 &amp; IPv6. The purpose is to allow or deny access to the Laravel routes by IP address. It is able to allow certain IPs (IPv4 or IPv6) to access default files or envirioments, and redirect non-authorized IPs or Users to an external URL, while letting whitelisted IPs to have access to the entire site or to a special Envirionment.

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

[](#requirements)

- PHP `^8.0`
- Laravel `8.x` – `13.x` (`illuminate/contracts`)
- Laravel Nova `^4.0|^5.0` (optional — only required when using the Nova IP management feature)

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

[](#installation)

You can install the package via composer:

```
composer require marshmallow/ip-access
```

And publish the service provider (and config):

```
php artisan vendor:publish --provider="Marshmallow\IpAccess\IpAccessServiceProvider"
```

This is the contents of the published config file:

```
return [

    // ENABLE IP ACCESS
    'enabled' => env('IPACCESS_ENABLED', true),

    // ENV TO CHECK IP ADDRESS FOR
    'whitelist_env' => env('IPACCESS_ENV', 'production'),

    // WHITELIST IPs GET ACCESS TO ENV
    'whitelist' => [
        'range' => [
            '127.0.0.*',
        ],
        'list' => [
            '127.0.0.1',
        ]
    ],

    // ROUTES THAT BYPASS THE IP CHECK (see "Disable lock for routes and webhooks")
    'except' => [
        //
    ],

    // ACCESS DENIED RESPONSE SETTINGS
    'redirect_to'      => env('IPACCESS_DENIED_URL', null),
    'response_status'  => env('IPACCESS_DENIED_STATUS', 403),
    'response_message' => env('IPACCESS_DENIED_MESSAGE', 'Access not Allowed'),

    // ACCESS PATH FOR LOGGING (reports denied requests to Sentry when bound)
    'access_path_enabled'  => env('IPACCESS_PATH_ENABLED', false),
    'access_path' => env('IPACCESS_PATH', '/ip-access'),

    // KEEP TRACK OF THE IP ADDRESSES USING NOVA
    'use_nova' => true,
];
```

Optional
--------

[](#optional)

These are the optional .env variables to set up:

```
    # ENABLED
    IPACCESS_ENABLED=true

    # ENV THAT IS CHECKED BY IP e.g. staging
    IPACCESS_ENV=production

    # ADDIOTNAL IP LIST
    IPACCESS_WHITELIST="127.0.0.1,123.456.789.12"   # SEPERATED BY ,

    # URL TO REDIRECT TO:
    IPACCESS_DENIED_URL="https://marshmallow.dev"

    # IF URL NOT SET
    IPACCESS_DENIED_STATUS=403                      # REDIRECT STATUS
    IPACCESS_DENIED_MESSAGE="Not allowed"           # REDIRECT STATUS MESSAGE

```

Disable lock for routes and webhooks
------------------------------------

[](#disable-lock-for-routes-and-webhooks)

If you are testing webhooks on an ip locked envoirment you need to open up your application so the webhooks won't be blocked. You can do this by adding values in the config array `except`. Below you will find a few examples.

### Just open up a route

[](#just-open-up-a-route)

Add a url to the array to just open it up. If this route is matched, the package will just let the request through.

```
'except' => [
    'webhook/*',
],
```

### Open up with a secret

[](#open-up-with-a-secret)

If you want to open up the route but want to require the request to have a secret, you can do so by adding some settings to the except array.

#### Via headers

[](#via-headers)

```
'except' => [
    'webhook/*' => [
        'secret' => [
            'source' => 'header',
            'key' => 'x-webhook-secret',
            'value' => 'TEST_SECRET_HEADER',
        ],
    ],
],

/** This request will be allowed by the config above. */
Http::withHeaders([
  "x-webhook-secret" => "TEST_SECRET_HEADER"
])->get("https://marshmallow.dev/webhook/is/open");
```

#### Via body/query string

[](#via-bodyquery-string)

```
'except' => [
    'webhook/*' => [
        'secret' => [
            'source' => 'body',
            'key' => 'secret',
            'value' => 'TEST_SECRET_BODY',
        ],
    ],
],

/** These requests will be allowed by the config above. */
Http::get("https://marshmallow.dev/webhook/is/open?secret=TEST_SECRET_BODY");
Http::get("https://marshmallow.dev/webhook/is/open", [
  "secret" => "TEST_SECRET_BODY"
]);
Http::post("https://marshmallow.dev/webhook/is/open", [
  "secret" => "TEST_SECRET_BODY"
]);
```

Usage with Laravel Nova
-----------------------

[](#usage-with-laravel-nova)

If you want to keep track of the ip addresses that have access using Laravel Nova you need to follow the following steps.

To add an check for IP access in Nova, add the following to NovaServiceProvider:

```
Gate::define('viewNova', function ($user) {
    return IpAccess::hasBackofficeAccess();
}
```

### Update your config file

[](#update-your-config-file)

Set `use_nova` to true in `config/ip-access.php`.

```
return [
    'use_nova' => true,
];
```

### Run migrations

[](#run-migrations)

You need to run the migrations after you've update the config file so we have the tables we need to store the ip addresse.

```
php artisan migrate
```

### Publish the Nova resource

[](#publish-the-nova-resource)

The last step is publishing the Nova resource so you can manage all ip address in your Laravel Nova installation.

```
php artisan marshmallow:resource IpAccess IpAccess
```

Uninstall
---------

[](#uninstall)

Once your application is done and you are going to publish your application to production for the whole world to see, you can delete this package. You don't need it anymore and its always good practice to keep your code clean. Run the command below to uninstall this package. This command will delete the `config` file. Delete the `nova resource`, delete the `migration` record, delete the `ip_accesss` database table and remove the package from your `composer` file. You will have to review and commit the changes in you GIT repository yourself.

```
php artisan ip-access:uninstall
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [LTKort](https://github.com/LTKort)
- [Stef van Esch](https://github.com/stefvanesch)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance89

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity69

Established project with proven stability

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

Recently: every ~184 days

Total

25

Last Release

107d ago

Major Versions

v0.1.0 → v1.0.02021-01-23

v1.3.3 → v2.0.02022-05-04

v1.4.0 → v2.1.02023-01-17

PHP version history (3 changes)v0.0.6PHP ^7.4|^8.0

v1.3.2PHP ^7.4|^8.0|^8.1

v2.0.0PHP ^8.0

### Community

Maintainers

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

---

Top Contributors

[![stefvanesch](https://avatars.githubusercontent.com/u/46725619?v=4)](https://github.com/stefvanesch "stefvanesch (35 commits)")[![LTKort](https://avatars.githubusercontent.com/u/2412670?v=4)](https://github.com/LTKort "LTKort (33 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

laravel-novamarshmallowip-access

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/marshmallow-ip-access/health.svg)

```
[![Health](https://phpackages.com/badges/marshmallow-ip-access/health.svg)](https://phpackages.com/packages/marshmallow-ip-access)
```

###  Alternatives

[illuminate/support

The Illuminate Support package.

630113.0M41.3k](/packages/illuminate-support)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[illuminate/collections

The Illuminate Collections package.

27078.0M1.1k](/packages/illuminate-collections)[illuminate/config

The Illuminate Config package.

10944.5M2.5k](/packages/illuminate-config)[illuminate/pagination

The Illuminate Pagination package.

12234.1M1.0k](/packages/illuminate-pagination)[illuminate/pipeline

The Illuminate Pipeline package.

9349.2M282](/packages/illuminate-pipeline)

PHPackages © 2026

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