Download the PHP package skitlabs/ip-restriction-for-laravel without Composer
On this page you can find all versions of the php package skitlabs/ip-restriction-for-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package ip-restriction-for-laravel
IP Restriction Middleware for Laravel
Configurable IP allow-/blocklist (white-/blacklist) middleware package for Laravel 12 and 13.
Secure routes, groups, or the entire application using single IPs, CIDR ranges, or predefined configuration groups. Allows for per-route configuration overrides.
Features
- Allow- & Blocklist: Using the provided
ip.allowandip.blockmiddleware. - CIDR Support: Supports IPv4 and IPv6 CIDR ranges (e.g.,
10.0.0.0/8,2001:db8::/32). - Named Groups: Group IPs in your config file (e.g.,
office,webhooks) for clean and reusable lists. - Route-Level Overrides: Override log level, channel, and config prefixes directly in your route definitions.
- Stateless & Octane Ready: Compatible with long-running processes that handle multiple requests, like Laravel Octane.
Requirements
- PHP
^8.3 - Laravel
^12.0or^13.0
Installation
Install the package with composer:
Publish the configuration file:
This will create a config/ip_restriction.php file in your application.
Usage
The package automatically registers two middleware aliases:
ip.allow(Allow only the configured IPs, blocking all other requests)ip.block(Block only the configured IPs, allowing all other requests)
Apply the middleware directly to your routes or route groups in routes/web.php or routes/api.php:
Overrides
You can dynamically override middleware behavior per group or route. These overrides are resolved before evaluating other configuration. The last override wins.
Logging
Config Prefix
By using the config:-prefix, you can override the base configuration key. This can be useful when managing multiple domains (e.g., Admin Panel and API) that require different defaults.
The following example would read configuration from config/api_restrictions.php instead.
Global Middleware Registration
You can register the middleware globally, or configure it manually using the static configure()-method, in your bootstrap/app.php file.
Inline Middleware Configuration
Use the middleware's static configure-method, and pass an instance directly to your routes/groups.
Configuration
The published config/ip_restriction.php allows control over how the middleware behaves:
Testing
License
The MIT License (MIT). Please see License File for more information.
All versions of ip-restriction-for-laravel with dependencies
illuminate/support Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
illuminate/routing Version ^12.0|^13.0
symfony/http-foundation Version ^7.0|^8.0