j-ben87/parsley-bundle
Symfony bundle that integrates Parsley.js client-side form validation with Symfony forms. It maps form constraints to Parsley attributes, cuts manual markup, and helps add consistent browser-side validation with minimal configuration. Useful when you want browser-side checks that complement server-s...
Architecture fit — the framework mismatch is the headline, and it reframes the whole assessment. Despite the "Laravel/PHP package" framing, j-ben87/parsley-bundle is a Symfony bundle that reads symfony/validator constraint metadata off form types and emits Parsley data-parsley-* attributes at render time. Its core input is a Symfony constraint graph (ClassMetadataInterface, getConstrainedProperties()) delivered through a bundle class, DI extension, and Twig form-theme integration. Laravel has no bundle concept and does not express validation as constraint metadata — Illuminate\Validation is a rule-array/rule-object system. The source data this package transforms does not exist in a standard Laravel app, so this is not a shim-able gap; it is an absent input.
For a TPM, that means the leverage here is not procurement — it is pattern transfer. What is genuinely reusable is the mapping semantics: how a constraint type plus its options becomes a specific data-parsley-* attribute set, including message handling and escaping. That is a bounded artifact on the order of a few hundred lines. Everything around it — metadata reading, container wiring, form-theme rendering — is Symfony-coupled and gets discarded.
Integration feasibility — port the concept, do not wrap the package. A Laravel equivalent is a small internal package exposing either a @parsley Blade directive or a ParsleyAttributes::fromRules(array $rules) helper that consumes the same rules() array already declared on your FormRequest. That is a rewrite against a different input schema, not an integration. Estimate 3–5 engineer-days to include a table-driven test matrix per rule type. That is competitive with — and safer than — shimming the bundle, which still leaves you maintaining a fork of Symfony-coupled code you would be fighting on every upgrade.
Technical risk — high on every axis we normally score.
Valid traversal, When/conditional constraints, and callback constraints. Client-side parity is inherently partial. The dangerous case is a constraint that silently no-ops — the attribute simply isn't emitted, so the rule appears to work while the client never enforces it.Key questions to resolve before any commitment:
NotBlank, Length, Regex, Email, Range, Choice, Collection — and which constraints silently no-op?Stack fit — replicate, don't adopt. This is a build-vs-adopt decision and adopt loses on every dimension except time-to-first-attribute. The right move is a 1–2 day spike that extracts the constraint→attribute mapping semantics, then implement a small internal Laravel package against Illuminate\Validation rules — the schema we actually have. This keeps the contract under our control, makes unsupported-rule behavior an explicit design choice, and avoids inheriting Symfony upgrade coupling.
Migration path. There is nothing to migrate — the bundle was never wired into our stack. If a Symfony service does exist in the estate, the sequence is: audit constraint coverage → confirm PHP floor (attributes imply PHP 8.0+) and Symfony major-version compatibility → fork and vendor → treat the fork as the long-lived artifact with upstream as reference-only. If symfony/validator is genuinely present somewhere, a thin bridge is defensible; otherwise it is pure overhead.
Compatibility. Unverified and must be confirmed before sequencing anything: PHP floor, Symfony major version, Parsley major version, and whether messages route through Symfony's translator (a Laravel app would need __() substitution). The December 2023 release sits at the edge of recent Symfony 7 work — assume it targets Symfony 5/6.
Sequencing (if we proceed at all):
Decision: treat parsley-bundle as a reference implementation, not a dependency. Score 0.37, 14 stars, and 0 dependents are consistent with that read.
Maintenance. As a dependency, we inherit an unmaintained bundle whose upstream may never ship a fix — forcing a fork we then own, which is the worst of both worlds: adoption cost plus ownership cost. As a port, we own roughly 300 lines of well-understood code with our own tests, which is the cheaper long-run position. Either way, assume we are the maintainer within 12 months. Plan an explicit ownership model: a named owner and a review cadence for the mapping table.
Support. Single maintainer, zero dependents, no evidence of a community channel. The escalation path for a defect is "open an issue and wait," which is not acceptable for anything on a checkout or registration flow. Internal ownership is the only viable support model; do not let a user-facing path depend on upstream responsiveness.
Scaling. Computationally trivial — metadata inspection plus string formatting at render time, memoizable per request. No throughput, memory, or query concerns. The real scaling constraint is rule-surface growth: every new server-side rule must be classified as "maps to Parsley," "maps approximately," or "server-only." Without a documented policy that list rots and the client/server contract drifts silently. That governance step, not infrastructure, is the operational bottleneck.
Failure modes, ordered by severity:
aria-invalid and an announcement region, and invisible entirely without JS. The server-rendered error path must remain the complete fallback.Ramp-up. Low for the port path — the concepts (decorate form rendering, map rules to attributes) are familiar to any Laravel engineer, and the mapping table is self-documenting reference material. Budget half a day of reading the upstream source during the spike and one hour of internal docs afterward. The ramp-up cost that actually matters is organizational: getting the team to consistently classify new rules as client-mappable versus server-only. Encode that in the PR template for FormRequest changes, or the discipline decays within two sprints.
Exit criteria. If the flag-on cohort shows a measurable drop in server-side validation failures per session (or in form abandonment), keep and maintain. If not, remove the Parsley runtime and keep the constraint definitions as-is — rollback is clean precisely because nothing authoritative lives in the bundle.
How can I help you explore Laravel packages today?