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

Laravel Fluent Validation Laravel Package

saritasa/laravel-fluent-validation

A Laravel package that adds fluent, chainable validation rule builders, letting you define complex validation logic in expressive PHP instead of long arrays or strings. It simplifies custom rules and keeps validators readable, reusable, and easy to maintain.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. The package is a developer-ergonomics layer, not a runtime component. Laravel validation is fundamentally array/string based ('email' => 'required|email|max:255' or ['required','email']); complex rule sets involving sometimes, required_if, bail, nested wildcards (items.*.sku), and Rule:: objects become hard to read and easy to get wrong. A fluent builder that emits the same underlying array sits cleanly alongside FormRequests and Validator::make() — no service provider gymnastics, no container coupling, no middleware, no request-lifecycle hooks. Architecturally this is near-zero-friction.

Integration feasibility. composer require with an MIT license; integration is an afternoon, not a sprint. The caveat is that with 8 stars and 0 dependents, there is no ecosystem signal to lean on — this must be evaluated by reading the source, not by trusting adoption. Expect a small codebase (likely a few hundred LOC), which makes a source audit realistic.

Technical risk.

  • Archived, last release 2024-01-08. That predates Laravel 11 GA (March 2024) and Laravel 12 (Feb 2025). Compatibility with illuminate/validation v11/v12 and PHP 8.3/8.4 is unverified. There is no stated support matrix.
  • Bus factor of one. Saritasa internal tooling, likely extracted from a client engagement. Zero external contributors is the expected shape.
  • Low blast radius, but a dangerous failure mode. The library doesn't sit on the request hot path beyond rule construction, so throughput and availability risk are negligible. The real hazard is silent rule omission: a builder that drops nullable, mis-orders bail, or mishandles an implicit rule produces validation that passes when it shouldn't. A validation library that throws is fine; one that quietly under-validates is a security and data-integrity problem.
  • Security surface. Narrow but non-zero. Rules are strings; if any builder path performs dynamic string assembly or regex construction, verify no user-influenced input reaches it. Otherwise the risk is bounded by what native Laravel validation already accepts.
  • Licensing is clean (MIT), so forking and vendoring are permitted without negotiation.

Key questions.

  • Which Laravel and PHP versions are supported and actually exercised in CI? Does it run on 11.x and 12.x?
  • Does the test suite assert array equivalence against hand-written native rules, or only that builders don't throw?
  • How are sometimes, required_if/exclude_if, bail, nullable, and implicit rules (accepted, declined) represented?
  • Does it support nested/wildcard keys and pass through Rule:: objects, or only scalar string rules?
  • How are custom messages and attribute-name translation handled?
  • What is the public API surface we'd inherit if we fork?
  • Does it return array (losing type information) or typed objects? Does it play well with Larastan/PHPStan and IDE completion?

Integration Approach

Stack fit. Best fit is a Laravel application with heavy FormRequest usage, particularly API resources with 20+ field payloads and rule sets duplicated across store/update variants or across controllers. Poor fit for small CRUD apps where native array syntax is already readable — the DSL would be net overhead.

Migration path — phased and reversible:

  1. Do not add it as a floating runtime dependency. Fork into a private org repo (or vendor into app/Support/Validation) pinned to a commit.
  2. Audit first. Run the existing test suite locally against our Laravel matrix, then read the builder-to-array compilation paths specifically for nullable, sometimes, and conditional rules.
  3. Pilot on one or two high-density FormRequests — not authentication, not payments, not anything where an under-validated rule is a compliance issue.
  4. Gate on conversion tests: for every migrated request, assert the fluent output is identical to the legacy array. This is the whole safety story.
  5. Decide: broad adoption, keep only as an internal pattern, or drop. Set the kill criterion before the pilot.

Compatibility.

  • Pin the fork to our supported Laravel/PHP matrix and add CI jobs for v11 and v12 plus current PHP.
  • Because the output is (presumably) plain arrays, a fallback exists at every call site: invert the builder call to the literal array. That reversibility is the single most de-risking property of this package — call it out explicitly to stakeholders.
  • Consider a trimmed in-house shim (~200–300 LOC) covering only the constructs we actually use, rather than inheriting the full third-party surface. For a package this small, the ownership cost of a full fork often exceeds the cost of writing the 20% we need.

Sequencing.

  • Week 1: source audit, test run, compatibility matrix; fork + CI.
  • Week 2: conversion tests on 1–2 pilot requests; document the DSL.
  • Weeks 2–4: single-team pilot; measure review time and validation-related defects.
  • Week 4: decision gate → adopt broadly / keep as pattern / retire.
  • If adopted: add to the team style guide and an architecture rule enforcing equivalence tests for any new builder method.

Operational Impact

Maintenance. The decisive operational fact: adopting this means we become the maintainer. Archived upstream means no bug fixes, no Laravel 13 readiness, no security patches, and no one to escalate to. Budget a named owner for a few hours per quarter plus a bump whenever Laravel ships a major. This is cheaper than it sounds because the library is small and its contract — emit an array — is one Laravel changes slowly; breakage will likely be mechanical (signature drift), not semantic.

Support. No vendor. Support is an internal channel plus the fork's README. The bigger support cost is the house dialect: new hires know 'required|email', not our fluent chain. Documentation is the real expense here, not code.

Scaling. Runtime cost is negligible — per-request allocation of a small array. No caching, no shared state, no concurrency concerns. This scales to any request volume. The scaling risk is codebase scale: surface area to maintain and patterns to keep consistent across teams.

Failure modes (ranked):

  1. Silent rule drop — validation passes when it shouldn't. Highest severity; mitigated only by equivalence tests and a policy that every builder method has one.
  2. Framework upgrade break — Illuminate\Validation\Rule or Validator signature changes across a Laravel major. Detectable in CI.
  3. House-dialect drift — teams use the fluent API inconsistently or mix paradigms in one file, hurting readability (the very thing it's meant to improve).
  4. Fork neglect — internal fork rots with no upstream to rebase from. Acceptable, since there is nothing upstream to track.
  5. Rule injection — low probability, contingent on dynamic string assembly; verify during audit.

Ramp-up. Roughly half a day for a mid-level Laravel developer to use the DSL competently; one to two days for the owner to understand internals well enough to fork and patch. Reversal cost is low and mechanical, which keeps the downside bounded.

TPM recommendation. Given 8 stars, 0 dependents, an archived repo, and a native Rule:: API that already covers most of the gap, do not adopt this as a live dependency. Treat it as a reference implementation: audit it, run a two-week pilot to see whether fluent construction measurably reduces validation defects and review time, and if it does, vendor a trimmed internal helper behind our own tests. Set the kill criterion at the start — if the pilot shows no measurable win, retire it and keep the native syntax.

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.
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib