shapecode/hidden-entity-type-bundle
A Symfony bundle that adds a hidden entity form type, letting you pass entity IDs through hidden fields and have them automatically transformed back into Doctrine entities on submit—useful for forms that reference entities without showing a visible selector.
Architecture fit. The package is a Symfony bundle, not a Laravel package — this is the single most important framing correction. It supplies a HiddenEntityType form type plus a Doctrine-backed data transformer that takes a hidden input value (typically an entity identifier) and resolves it back to a managed Doctrine entity during form submission. Its dependency graph is therefore Symfony Form + Doctrine Bridge + Doctrine ORM EntityManager. None of that exists in a Laravel request lifecycle, so "fit" against a Laravel stack is effectively zero without a Symfony runtime.
Where a Symfony application (or a Symfony-based admin/back-office service running alongside Laravel) is in the estate, the fit is good and idiomatic: it fills a small but real gap — hidden fields that must carry an entity reference without exposing a full entity choice widget.
Integration feasibility (Laravel). Not viable as a dependency. The equivalent behaviour in Laravel is roughly 20–40 lines: a hidden input, an exists: or Rule::exists() validation rule scoped to the tenant/owner, and route-model binding or a manual findOrFail in the form request. Reproducing the bundle's semantics is a half-day task and removes a third-party dependency entirely. The recommendation for a Laravel-primary stack is to reimplement, not integrate.
Technical risk.
query_builder.TransformationFailedException unless invalid_message is configured, which is easy to get wrong and produces 500s rather than validation errors.Key questions to resolve before any commitment.
query_builder, choice_value, invalid-message handling) sufficient to enforce tenant scoping and authorization at the form layer?Stack fit. Decide first which runtime this is for. In a Symfony service: register the bundle in config/bundles.php, require the package, and use HiddenEntityType::class in the form builder with the class option. Clean, no adapters, hours of work. In a Laravel service: do not integrate — implement the equivalent locally with a hidden input, a scoped exists rule, and explicit authorization, and document the bundle as the reference design rather than a dependency.
Migration path. Because the package is a thin data transformer, there is no meaningful migration to plan in either direction — it is adopt-or-reimplement, not a platform shift. If we adopt in Symfony and later need to exit, the replacement is a custom DataTransformerInterface implementation plus a form type, which is a contained change in the forms layer with no data-model impact. Treat it as an easily reversed decision, which lowers the cost of a trial.
Compatibility. Pin explicitly. Verify the release's composer.json constraints against our Symfony and Doctrine majors rather than relying on the README; bundles in this size class often lag a major behind. Run composer why-not against our platform packages during the spike. Also confirm PHP version support, since the bundle predates or straddles PHP 8.x type changes depending on the tag.
Sequencing.
query_builder, authorization check on submit, and a sane invalid_message.Maintenance. Runtime maintenance is near zero — no background jobs, no schema, no config beyond bundle registration. The real cost is upgrade maintenance: expect to absorb Symfony major-version bumps ourselves once upstream activity stops. Budget a small annual allowance for a fork-and-patch, or accept the reimplementation path where maintenance is fully ours from day one but bounded at a few dozen lines.
Support. Community-only, no vendor, no SLA. Escalation path is a GitHub issue on a low-traffic repository. For anything on a revenue path, treat internal ownership as the default and the upstream repository as an optional convenience.
Scaling. Negligible. Each hidden entity field costs one primary-key lookup per submitted form. Watch for forms that stack several such fields plus collection types, where the per-field lookups compound into a modest N+1 pattern; batch preloading is the mitigation if it ever matters. This will not be a capacity constraint.
Failure modes to instrument and guard.
invalid_message this reads as a 500, so ensure it degrades to a validation error and log the distinction.query_builder and an explicit authorization check in the controller or a Voter; do not rely on the field being hidden.find-style resolution — the bundle resolves by identifier, so scoping is the caller's responsibility every time. Make this a mandatory code-review checkpoint wherever the type is used.Ramp-up. For a developer already fluent in Symfony Forms and Doctrine, effectively zero — under an hour to first productive use, and the concepts are standard. For a Laravel-only team, the bundle itself is not learnable-and-usable, because the surrounding Form component is absent; the relevant ramp-up is the half-day to write the equivalent, and the conceptual transfer (hidden field + existence validation + authorization) is immediate. Net: low training cost either way, with the caveat that the "adopt the package" path only exists for teams already on Symfony.
How can I help you explore Laravel packages today?