Laravel IP Gateway is a good package which helps us to blacklist or whitelist IP to prevent unauthorized access.

laravel blacklist ip gateway

Since blacklists deny access to specific entities, they are best used when a limited number of items need to be denied access. When most entities need to be denied access, a whitelist approach is more efficient.


You can install the package via composer:

composer require viitorcloud/laravel-ip-gateway

After installation, You need to publish the config file for this package. This will add the file config/ip-gateway.php, where you can configure this package.

php artisan vendor:publish --provider="LaravelIpGateway\IpGatewayProvider"

Source Code and Docs