vpndetection/laravel
A Laravel package for detecting VPN and proxy connections, helping you screen requests, enforce access rules, and add risk checks to your application with simple configuration and integration.
Install the SDK and its required core dependency (v2.2.4 pins vpndetection-io/vpndetection to ^4.8.0, which is what exposes isPubproxy() and the pubproxy detail payload):
composer require vpndetection-io/sdk-php-laravel
php artisan vendor:publish --tag=vpndetection-config
Set VPNDETECTION_API_KEY in .env. Look first at config/vpndetection.php (cache TTL, base URL, timeout) and the package facade (VpnDetection). A typical first use case is gating registration or checkout:
use VpnDetectionIo\Laravel\Facades\VpnDetection;
$result = VpnDetection::check($request->ip());
if ($result->isVpn() || $result->isProxy() || $result->isPubproxy()) {
abort(403, 'VPN/proxy connections are not allowed.');
}
If you are upgrading an existing install, confirm vpndetection-io/vpndetection resolved to 4.8.0+ before calling isPubproxy(); older 4.x versions will fail with an undefined-method error.
NoVpnOrProxy) that returns a validation message rather than aborting, which plays better with form-based flows and Inertia/Livewire responses.Cache::remember("vpn:{$ip}", now()->addMinutes(30), ...) to avoid burning API quota and adding latency to every request.details()/pubproxy detail methods when you actually need the reason (e.g. abuse review dashboards). For allow/deny gates, the boolean checks (isVpn, isProxy, isPubproxy) are cheaper and clearer.users/orders table instead of blocking the request.isPubproxy as one signal among VPN/proxy/Tor checks. A public proxy hit is high-confidence, but don't equate a clean result with "safe" — layer it with rate limiting and device fingerprinting.isPubproxy() and pubproxy details require vpndetection-io/vpndetection 4.8.0. Run composer update vpndetection-io/sdk-php-laravel vpndetection-io/vpndetection together and check composer.lock if you see Call to undefined method.filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) before calling the API.$request->ip() may return your load balancer unless TrustProxies is configured. Verify X-Forwarded-For handling before trusting a "clean" result.try/catch. Don't let an SDK outage take down login.X-Forwarded-For to bypass cached blocks.config/vpndetection.php, run php artisan config:clear in local/dev. In production, config:cache will freeze env values — never call env() at runtime.TestCase or use Laravel's Http::fake() if the SDK is HTTP-backed. Assert both the allow and deny paths, including the new pubproxy branch.How can I help you explore Laravel packages today?