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

Http Precondition Bundle Laravel Package

guhemama/http-precondition-bundle

Symfony bundle for handling HTTP precondition headers such as If-Match, If-None-Match, If-Modified-Since, and If-Unmodified-Since. Helps controllers return correct 304 or 412 responses and enforce optimistic concurrency without repetitive header logic.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Delta since the prior assessment — 1.0.1 is a packaging release, not a capability release. The notes describe "improve configuration" and "use standard bundle naming (now it includes the vendor name)." That is a rename to Symfony's conventional <Vendor><Name>Bundle form plus configuration cleanup. It does not touch the condition matcher, the expression evaluator, the response factory, listener priority, or the 412 semantics. The evaluation below is unchanged in substance; only the recency and governance observations are revised.

Architecture fit — still poor at the package level, sound at the concept level. This remains a Symfony Bundle: it registers via BundleInterface and hooks the kernel.request event of Symfony's event-driven HttpKernel. Laravel has no bundle registry, and its HTTP kernel (Illuminate\Foundation\Http\Kernel) is a different class; Laravel pulls symfony/http-kernel only transitively for HttpKernelInterface / HttpExceptionInterface, not for the dispatch pipeline this bundle extends. There is no drop-in surface. 1.0.1 does not change this — a rename makes the bundle more conventionally Symfony, not more portable. What remains transferable is the idea: declarative, per-route preconditions evaluated before the controller, returning 412 Precondition Failed. That concept maps cleanly onto Laravel middleware, FormRequest::authorize(), or a Route::macro.

Integration feasibility — port, don't install. The reusable logic is likely small: a request matcher, an expression evaluator, a listener, and a response factory. symfony/expression-language is a standalone component that works inside Laravel, so the condition-evaluation half survives intact; only the kernel wiring has to be rewritten as middleware. Estimate unchanged: 1–2 engineer-days for a spike plus a tested port.

Technical risk — high, and mostly supply-chain rather than technical.

  • Recency (revised): 1.0.1 is the first release since 2023-01-06 — roughly one patch release in over two years. This is marginally better than a fully dead repo, but it is a maintenance pulse, not a maintenance commitment. Still 2 stars, 0 dependents, single maintainer, composite score 0.414 and opportunity 1.72 — no downstream validation, bus factor of one, unknown security posture.
  • Semver hygiene (new): a bundle rename is breaking for existing Symfony consumers (config/bundles.php entries, service/parameter naming conventions) yet shipped as a patch bump. Loose versioning discipline upstream reinforces the "vendor nothing" conclusion. It costs us nothing only because we already recommend against installing the package.
  • Unanswered questions: 1.0.1 does not address any of the six questions below — no sandboxing statement, no status-code configurability, no constraint disclosure, no coverage signal.
  • Semantics risk: RFC 9110 defines 412 for conditional requests (If-Match, If-None-Match, If-Unmodified-Since). Repurposing it for arbitrary route preconditions (authz, feature flags, state checks) invites misbehavior from HTTP caches, CDNs, and client retry logic. 403, 409, or 422 are usually the correct codes.
  • Evaluation risk: if preconditions are declared as expressions, an unsandboxed evaluator over route definitions is an injection surface whenever the definition source is not fully trusted.

Key questions for the maintainer/repo before any investment (all still open):

  1. Which symfony/http-kernel constraint, and is the core logic separable from the bundle wiring?
  2. How are preconditions declared — route defaults, PHP attributes, YAML?
  3. Is symfony/expression-language used, and is it sandboxed? What variables are in scope?
  4. Is the 412 fixed or configurable per precondition?
  5. Where in the listener priority does it run relative to security/access_control?
  6. Test coverage and CI status? (Does 1.0.1 ship with tests for the new configuration path?)

Integration Approach

Stack fit. Laravel 10/11 ship symfony/http-kernel ^6.2/^7.0; a bundle with 2023-era wiring may cap at ^5.4/^6.0, producing a Composer conflict even if we wanted to autoload pieces. 1.0.1 gives no new constraint information, so treat compatibility as still unverified. That is moot under the recommended path because we consume source, not the package. symfony/expression-language ^6 is Laravel-compatible and can be required directly if the DSL is worth keeping.

Recommended migration path:

  1. Vendor nothing. Fork the matcher/evaluator into app/Http/Middleware/PreconditionMiddleware.php, or expose it as a Route::precondition() macro on Illuminate\Routing\Route for declarative per-route syntax.
  2. Use the upstream repo (now at 1.0.1) in a throwaway branch only to read and exercise the reference implementation; never ship it as a dependency.
  3. Wrap it in feature tests that assert the status code, the short-circuit point, and the behavior when a precondition raises.

Build-vs-buy alternative. For most stated needs, Laravel primitives already cover the use case: FormRequest::authorize(), can: route middleware, signed, throttle, route-model binding, and custom validation. Only port the DSL if you specifically need declarative per-route expressions plus a uniform response code — still the only capability here that Laravel lacks out of the box.

Compatibility. PHP 8.1+ is fine; no service-container bindings, facades, or config publishing are needed in the ported form. The bundle-naming change is invisible to a source-level port.

Sequencing.

  1. Requirements capture: which routes, which conditions, which status code per condition class.
  2. Spike port (1–2 days), reusing expression-language if the DSL is retained.
  3. Parity tests against the reference implementation (pin to 1.0.1) on a fixture set of requests.
  4. Register a middleware alias and run in shadow/log-only mode for one release to observe would-be 412s before enforcing.
  5. Enforce, then delete the reference branch.

Operational Impact

Maintenance. You own the fork permanently. Upstream is best described as barely alive rather than dormant: one patch release in two-plus years, configuration and naming only. Assume no patches arrive for anything you actually care about. Budget ~2–4 hours/quarter for dependency bumps plus occasional breakage on expression-language majors. Assign a named owning team before adoption — this remains the gating operational decision.

Support. No vendor, no SLA, GitHub issues only. Internal runbook and example library required; treat the package as documentation, not as a supplier.

Scaling. Per-request cost is negligible relative to typical middleware — a string or expression match. Two things to watch: (a) ensure expression compilation is cached, not re-parsed per request in a naive port; (b) order the middleware after auth so expensive condition evaluation never runs for anonymous traffic.

Failure modes.

  • Fail-open: middleware alias missing, or the precondition list resolving empty — silent and worse than not having the feature, because it creates false confidence in the guard.
  • 412 storms: a condition referencing a header a CDN or reverse proxy strips (e.g., If-Match at the edge) blocks all traffic at once.
  • Uncaught evaluation errors surface as 500s rather than controlled denials.
  • Ordering bugs relative to auth, throttle, and route-model binding produce inconsistent behavior that is hard to reproduce.
  • Semantic drift: clients and caches treating 412 as a conditional-request signal rather than an application denial.

Ramp-up. Low for Laravel engineers — middleware is familiar territory, roughly half a day per engineer including the DSL and status-code conventions. The real onboarding cost is the internal doc explaining when a precondition is appropriate versus a FormRequest, Gate, or can: middleware.

Bottom line for the portfolio: unchanged. The dependency is worth approximately zero — 1.0.1 is a rename and a config tidy, not a revival. The design reference is worth roughly one engineer-day. Fund a thin native Laravel middleware, cite this package (pinned at 1.0.1) in the design doc, and move on.

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/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
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