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

Firewall Laravel Package

pragmarx/firewall

A Laravel firewall package for managing IP blacklists and whitelists. It provides middleware, database-backed rules, and Artisan commands to block or allow requests by IP address (and optionally country), helping protect your app from unwanted traffic.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. pragmarx/firewall is an application-layer IP ACL implemented as Laravel HTTP middleware. It slots into the request lifecycle as a gate that runs before routing/auth, consulting an allowlist and a blacklist sourced from config and a database table, with a cache in front to avoid a query per request. That fits a narrow but real need: protecting admin panels, staging environments, partner-only endpoints, and coarse geo/country restrictions. It does not fit as a primary perimeter control — it cannot absorb volumetric traffic (every request still terminates in PHP), it cannot protect non-Laravel services in the estate, and it is blind to L7 attack patterns that a WAF handles. Position it as defense-in-depth behind an edge control, not as a replacement.

Integration feasibility. Mechanically straightforward for a Laravel team: composer require, publish config and migrations, register middleware in the HTTP kernel in the correct position, seed the allowlist. The real integration cost sits in two places: (1) client IP resolution — the middleware is only as correct as the Request::ip() it sees, so TrustProxies must be configured for the CDN/ALB topology or the ACL is both bypassable (spoofed X-Forwarded-For) and prone to false positives; (2) country blocking — that feature depends on a GeoIP dataset that requires licensing, periodic refresh, and a lookup dependency at request time.

Technical risk. The dominant risk is lifecycle, not design. The package's release history is anchored to the Laravel 5.x era; the repository shows low recent activity and the dependent count is effectively zero. Expect breakage on Laravel 9/10/11 and PHP 8.x: middleware signatures, container bindings, facade aliases, and typed properties are all plausible failure points. Secondary risks: IPv6 and CIDR edge cases, unbounded growth of the block table under attack (write amplification on the primary DB), cache staleness during an active incident, and NAT/VPN collateral damage where one blocked IP locks out an entire office. The 23.7 score and thin dependent base should be read as "adopt with a fork plan," not "adopt as-is."

Key questions.

  • What Laravel and PHP versions must be supported, and has the package been smoke-tested on the newest of each?
  • Behind a CDN/ALB, what is the authoritative client IP, and who owns TrustProxies correctness?
  • Who owns the blocklist lifecycle — security, platform, or the app team — and what is the unblock SLA and appeals path?
  • Is the intended control administrative (small, static allowlist) or adversarial (auto-blocking under attack)? The operational answers differ sharply.
  • Is country-based blocking a compliance requirement or a nice-to-have? If the former, is a GeoIP licence budgeted?
  • What is the exit plan: maintain a fork, or migrate policy to the edge within N months?

Integration Approach

Stack fit. Appropriate only for a Laravel-centric service. In a polyglot estate, IP policy belongs at the edge (Cloudflare/AWS WAF/nginx deny) where it applies uniformly and costs nothing per request; duplicating policy per-framework is a consistency bug waiting to happen. Recommended pattern: edge enforces the broad blacklist and geo rules; this package enforces a tight, auditable allowlist on high-value Laravel routes.

Migration path. Treat it as a tactical layer with a deliberate end state.

  1. Inventory — enumerate routes needing protection, existing IP allowlists, and the proxy/CDN topology.
  2. Pilot — deploy on a single low-risk surface (admin login) in log-only mode; validate client IP resolution against real traffic.
  3. Enforce — enable blocking with cache-backed lookups and alerting on block events.
  4. Consolidate — migrate durable policy to the edge and retain the middleware only for defense-in-depth on administrative route groups.

Compatibility. Pin exact versions and gate upgrades behind a PHP/Laravel matrix in CI. Run Larastan/PHPStan against the package on upgrade. Verify: middleware ordering relative to TrustProxies and auth; DB driver behaviour for the block table; Redis vs. file cache semantics (file cache on multi-node autoscaling will silently diverge); and IPv6 handling end-to-end. Budget a fork if the upstream is unresponsive — the code surface is small enough that vendoring is realistic.

Sequencing. Config and migrations first, then cache warm-up, then allowlist enforcement with internal ranges set to fail-open, then blacklist in monitor-only mode with logging, then enforcement, then alerting and a written runbook. Do not enable auto-blocking before the unblock procedure and false-positive review exist.

Operational Impact

Maintenance. Assume you own the code. Upstream is stale; the practical options are a pinned-and-patched fork or a scheduled replacement. Ongoing costs are small but non-zero: dependency drift on each Laravel major, GeoIP dataset refresh (monthly at minimum, with licence management), and periodic review of the blocklist for stale entries.

Support. The critical support requirement is speed of unblocking. On-call needs a documented, tested path to add/remove an IP in seconds without a deploy (artisan command or admin UI), an audit log of who blocked/unblocked what and why, and a named escalation path for lockouts. Without this, a false positive becomes a customer-facing outage with an engineer grepping a database.

Scaling. Steady-state cost is one cache lookup per request — acceptable. The scaling hazard is the write path: under a real attack, auto-blocking turns inbound traffic into database writes, which is exactly the wrong coupling. Mitigations: write to Redis with TTLs, batch/rate-limit block persistence, cap table size, and keep blocklists in a centralized store so autoscaled nodes agree. Note that the middleware adds latency only on cache misses; a per-node file cache will produce inconsistent policy across the fleet.

Failure modes. Enumerate and decide each explicitly: cache unavailable (fail-open vs. fail-closed — must be a documented choice, not an accident); database unavailable; proxy misconfiguration causing either a full lockout or a full bypass; stale GeoIP producing wrong country blocks; health-check endpoints blocked, causing the load balancer to drain healthy nodes; IPv6 traffic bypassing an IPv4-only rule; and blocked shared NAT egress taking out an entire office or VPN pool. Each needs a monitor and a runbook entry, not just a config value.

Ramp-up. Engineering ramp-up is roughly a day for a competent Laravel developer — the API surface is small. The real ramp-up is organizational: writing the block/unblock runbook, training on-call, defining ownership of the blocklist, and rehearsing a lockout recovery. Budget one to two sprints for hardening, observability, and the edge-migration decision rather than for the initial integration.

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.
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route