josantonius/ip
A lightweight PHP library for retrieving the client IP address, with helpers to validate IPs, detect private or reserved ranges, and handle proxied requests. Framework-agnostic and easy to drop into Laravel or any PHP project.
What it is. josantonius/php-ip is a single-purpose utility class whose only job is to return the caller's IP address, presumably by reading $_SERVER['REMOTE_ADDR'] and/or forwarding headers such as X-Forwarded-For / Client-IP. It is framework-agnostic, MIT-licensed, and effectively a 100-line convenience wrapper.
Architecture fit. Poor, because the capability is already native to the stack. Laravel exposes $request->ip() through Symfony's HttpFoundation, which is proxy-aware when combined with the TrustProxies middleware and trustedproxy configuration. Introducing a third-party dependency to duplicate a first-party method inverts the build-vs-buy calculus: we would add a Composer entry, a lockfile pin, and a supply-chain surface to replace zero lines of code.
Integration feasibility. Technically trivial — composer require josantonius/php-ip, then a static call. There is no service provider, no config publish, no facade, so it is not idiomatic Laravel and would appear as an inconsistent island in an otherwise framework-native codebase. The integration cost is low; the justification cost is what fails.
Technical risk.
X-Forwarded-For entry" implementation is trivially spoofable by any client sending that header. Whether this package validates chain order or exposes a trusted-proxy concept is the single most important unknown.Key questions for the maintainer/author (or for our own due diligence).
X-Forwarded-For parsed right-to-left with hop validation?::ffff:0:0/96) and zone IDs?Recommendation: Do not adopt as a dependency. The package is a redundant, unmaintained reimplementation of a framework primitive for a security-sensitive input.
Stack fit. Zero value-add for a Laravel codebase. Request::ip() is already available on every request, is maintained by Symfony's security process, and composes with Laravel's TrustProxies middleware, which is the canonical mechanism for declaring which load balancers/CDNs we trust to set forwarding headers. Adopting the package would create two competing sources of truth for client IP, which is exactly the kind of ambiguity that produces inconsistent rate-limit keys across services.
Migration path (if it is already in the tree, or if a legacy service requires parity).
$request->ip() behind the actual ingress (ALB, Cloudflare, nginx) for real traffic samples. Do not migrate blind — differing header precedence changes outputs.TrustProxies (protected $proxies / $headers) to match the real infrastructure, or use $proxies = '*' only when the app is unreachable except through the proxy. This is the substantive fix; the code swap is cosmetic.$request->ip() (or the Request facade in helpers), then composer remove josantonius/ip to retire the lockfile entry.app/Support/Ip.php with the MIT attribution notice retained. Vendoring preserves behavior, eliminates the dependency, and puts the code under our review and test coverage — strictly better than an archived package.Compatibility. The 2022-era release likely targets PHP 7.4–8.1. On PHP 8.3/8.4 it risks deprecation noise, and on Laravel 11 (PHP 8.2+) the supported-matrix claim is stale regardless of whether it happens to run. Since the package is framework-agnostic, it will not break Laravel bootstrapping — it will simply fail quietly at the edges.
Sequencing. Land the TrustProxies configuration and a characterization test before touching call sites, so behavior changes are observable. Then swap, then remove. Total effort: well under a sprint; likely a day including verification. The correct order is config → observe → replace → delete, never delete first.
Maintenance. Upstream maintenance is zero by definition (archived). Every future PHP upgrade, framework upgrade, or behavioral fix becomes an internal ticket with no vendor to escalate to. Carrying it means owning a fork we did not write and did not test. Retirement cost today is near-zero; retirement cost in two years, after it has quietly become load-bearing across services, is materially higher.
Support. No maintainer, no SLA, no release cadence, no security advisory channel. Incident response for an IP-attribution bug would be entirely internal, and debugging a dependency nobody on the team wrote and nobody monitors is the worst quadrant of support risk.
Scaling. Functionally irrelevant — IP parsing is stateless and O(1), with no memory, I/O, or concurrency implications. The scaling concern is not performance but semantics at scale: behind an autoscaling fleet or multi-hop CDN, every replica must agree on the client IP, or rate limiting partitions per-user limits into per-proxy limits and brute-force protection silently degrades. Correctness of proxy trust, not throughput, is the scaling property that matters.
Failure modes.
X-Forwarded-For; application records an arbitrary IP → rate-limit bypass, poisoned audit trail, IP-allowlist circumvention, fraudulent geo/locale behavior.'' into log/audit columns rather than failing loudly.Ramp-up. Negligible — an engineer reads the single class in minutes. That is not a benefit; it is evidence the package provides no leverage. The ramp-up cost that is real belongs to proxy trust configuration, and that knowledge is required whether or not this package is present.
Bottom line. Health score 0.0875 and archived status make this a clear reject as a dependency, despite the 9.1 opportunity signal, which reflects demand for the capability rather than the merit of this artifact. The capability is a framework built-in. Configure TrustProxies, use $request->ip(), and if any out-of-band call site genuinely needs the helper, vendor the class under app/Support with MIT attribution and our own tests.
How can I help you explore Laravel packages today?