Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Client Ip Laravel Package

middlewares/client-ip

A Laravel middleware for reliably resolving the client's real IP address, including requests passing through proxies, load balancers, and CDNs. Supports forwarded headers and configurable trusted proxies for accurate IP detection.

Deep Wiki
Context7

Technical Evaluation

Architecture fit. The package is a single-responsibility PSR-15 middleware that resolves the client IP and writes it to a request attribute. That is a clean, low-coupling design: it composes into any PSR-7/PSR-15 pipeline (Slim, Laminas/Mezzio, Expressive successors, Symfony via bridge) without touching application code. One important caveat for the stated context: this is not a Laravel-native middleware. Laravel's HTTP kernel uses its own handle($request, Closure $next) contract, not PSR-15, so adoption in a Laravel codebase requires an adapter/bridge or a wrapper middleware that delegates to the PSR-15 instance. That is a real, if small, integration cost—and it raises the question of whether the package is being pulled in for a Laravel app at all, or whether the framing in the request is inaccurate.

Integration feasibility. The functional surface is tiny (detect IP → set attribute), so the integration is nearly trivial in a PSR-15 host and modest in Laravel. There are no database, queue, or config-heavy dependencies implied. The main feasibility gates are (a) which PSR-7 implementation you run, (b) whether the attribute key is configurable or hard-coded, and (c) whether the package respects a trusted-proxy configuration. Those are answerable in an afternoon of spike work.

Technical risk. Several signals warrant caution:

  • Maturity: 16 stars and a score of 0.42 place this firmly in the "long-tail, unproven" band. There is no evidence of broad production usage.
  • Provenance: the repository is listed as unknown. That is a supply-chain red flag—no ability to review commit history, maintainer identity, CI status, or issue responsiveness before adoption.
  • Correctness risk is concentrated in IP resolution, which is deceptively hard: X-Forwarded-For chains, trusted-proxy allowlists, Cloudflare/ALB headers, IPv4-mapped IPv6, and header spoofing. A naive implementation can silently return an attacker-controlled value.
  • License: MIT is fine and low-friction.

Key questions.

  1. Does the middleware honor a configurable trusted-proxy list, or does it trust forwarded headers unconditionally?
  2. What is the attribute key, and is it configurable (to avoid collisions with framework-set attributes)?
  3. Does it normalize IPv4/IPv6 and strip port/zone identifiers?
  4. Which PSR-15 version(s) and PHP versions are supported, and is there a CI matrix?
  5. Who maintains it, and what is the release cadence beyond the single 2025-03-23 release?
  6. Is there an existing, better-supported alternative in our stack (Laravel's Request::ip() with TrustProxies, or Symfony's Request::getClientIp())?

Integration Approach

Stack fit. In a PSR-15-native stack (Slim, Mezzio), this drops in as one line in the middleware pipeline and is a good fit. In Laravel or Symfony, it duplicates functionality the framework already provides and ships with mature trusted-proxy handling—so the value proposition weakens considerably. If the target is Laravel, the honest recommendation is to prefer the framework primitive unless there is a specific reason (e.g., a shared middleware library across multiple frameworks).

Migration path. Adoption and removal are both cheap: register the middleware, consume the attribute, delete if needed. There is no schema, no persistent state, and no data migration. The only lock-in is the attribute key name leaking into downstream code—mitigate by reading it through a thin internal accessor rather than stringly-typed lookups scattered across the codebase.

Compatibility. Confirm PSR-15 v1 vs. v2, PSR-7 implementation compatibility (Nyholm, Laminas Diactoros, Guzzle), and the supported PHP range against our runtime. For Laravel, verify the bridge package is itself maintained. Test in a staging environment behind the actual edge (CDN/LB) before trusting the resolved value.

Sequencing.

  1. Spike: install in a branch, wire into the pipeline, assert the resolved IP against a known set of forwarded-header cases.
  2. Security review of IP-resolution logic (spoofing, trusted proxies).
  3. If adopted, wrap it in an internal adapter so the dependency is swappable.
  4. Roll out to a low-risk consumer (logging/analytics) before any security-sensitive consumer (rate limiting, audit trails, geo).

Operational Impact

Maintenance. This is the dominant concern. A 16-star package with an unknown repository and a single recent release should be treated as effectively unmaintained until proven otherwise. Pin the exact version, vendor or mirror the source, and add it to a dependency-review watchlist. Budget for the possibility of forking and owning ~100 lines of code—which is arguably the better outcome given the scope.

Support. No commercial support, no visible maintainer SLAs, limited community. Internal expertise must cover it.

Scaling. Runtime cost is negligible—a header parse and one attribute write per request. No memory, connection, or I/O implications. It will not be a bottleneck at any realistic throughput.

Failure modes.

  • Wrong IP behind a proxy/CDN if trusted proxies are misconfigured → misattributed rate limits, incorrect audit logs, broken geo/abuse detection.
  • Header spoofing if forwarded headers are trusted unconditionally → client-controlled identity in logs and any IP-based access control. This is the highest-severity risk.
  • Attribute key collision with framework- or app-set attributes.
  • Middleware ordering mistakes (placed after auth or routing, so consumers read a stale/absent value).
  • Silent divergence from framework behavior—two sources of "client IP" in the same app is a debugging hazard.

Ramp-up. Very low for engineers familiar with PSR-15: the concept and code are small. Laravel-only engineers will need a short explanation of the PSR-15 bridge and, more importantly, an explanation of why this exists alongside $request->ip(). Document the attribute contract and the trusted-proxy assumptions in the team's runbook; those two facts are what future responders will need at 3 a.m.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk