Skip to content

Description ​

Gate debug output to a single IP so you can dump on a live or shared environment without exposing anything to other visitors.

Snippet ​

php
if ($_SERVER["REMOTE_ADDR"] == '10.1.1.2') {
    dump('hi');
} else {
    dump($_SERVER['REMOTE_ADDR']);
}

Notes ​

The else branch prints the visitor's IP — handy for discovering your own address on first run, but swap it for a silent no-op before leaving this anywhere public.

Behind a proxy, load balancer, or Cloudflare, REMOTE_ADDR is the proxy's IP, not the visitor's. In Laravel, prefer $request->ip() with TrustProxies configured.