vectorface/whip
Whip is a lightweight PHP library for reliably determining a client’s real IP address, even behind proxies, load balancers, and CDNs. It supports IPv4/IPv6, trusted proxy headers, Cloudflare, and multi-proxy setups, helping PHP and Laravel apps log, rate-limit, and secure requests accurately.
$_SERVER['REMOTE_ADDR'] reading.Consider adopting when:
Look elsewhere or skip when:
TrustProxies middleware already covers your needs. For a standard single-CDN or single-LB setup, the framework middleware plus a configured proxy list is sufficient, and adding a dependency buys little. WhIP earns its place when you need finer control, multi-hop logic, or use outside the HTTP kernel.REMOTE_ADDR is already correct.Adoption risk to flag: v0.5.0 is a maintenance/modernization release, not a feature release. The changelog shows a single PR: PHP 8.0 floor, CI added, code modernized. That is a breaking change for PHP 7 consumers and a signal that the project is now actively maintained (CI is a genuine quality improvement) but remains a small, low-velocity, single-maintainer-adjacent project. Pin the version, and have a fallback plan since the surface area is small enough to vendor or reimplement if maintenance lapses.
To executives: This is a small, low-cost dependency that makes sure we know the real IP address of every visitor. That matters because rate limits, fraud checks, audit logs, and analytics all depend on it — and getting it wrong behind our CDN or load balancer silently undermines those controls. It is not a feature; it is insurance on features we already ship. Cost is negligible; the risk of not having it is mis-attributed traffic and bypassable abuse controls.
To engineering: WhIP handles trusted-proxy and forwarded-header resolution so we stop hand-rolling it. The v0.5.0 release adds CI and modernizes the code, and sets a PHP 8.0 minimum — so confirm our runtime baseline before upgrading, and treat 0.4.x as end-of-line if we can't. Recommended path: pin to 0.5.x, configure the trusted-proxy list explicitly per environment, and add a test asserting the resolved IP for a multi-hop request. If we're on a standard single-proxy setup and already have TrustProxies configured correctly, we can defer adoption — but we should document that decision and the trusted ranges either way.
How can I help you explore Laravel packages today?