kissifrot/select2entity-bundle
A Symfony bundle that turns entity form fields into AJAX-powered Select2 inputs, letting users search and pick related entities from large datasets without loading them all. It provides a form type, autocomplete controller, and configurable endpoints for paginated, server-side entity lookup.
Architecture fit — poor, and the framing needs correcting up front. Despite the "Laravel/PHP package" label in the request, this is a Symfony2 bundle, not a Laravel package. It hooks into Symfony's Form component (EntityType/FormTypeExtension), Twig, and Doctrine's EntityManager. Laravel has no equivalent extension points: no Symfony Form types, no bundle registration, no Doctrine entity field to replace. The only genuinely transferable asset is the pattern — swap a plain entity <select> for a Select2 widget backed by a remote JSON search endpoint — which in Laravel is roughly a Blade component plus a route returning {results: [{id, text}], pagination: {more: bool}}. That is a two-day build, not an integration.
Integration feasibility — effectively zero as a dependency. Installing via Composer pulls Symfony 2.3–2.8-era components (EOL since 2018), Twig 1.x, and PHP 5.x/7.0 constraints that conflict with illuminate/* and will not resolve on a modern Laravel 10/11 project. There is no service provider, no config publishing, no facades, no Blade views — none of the surfaces a TPM would normally assess for adoption. Any attempt to force it in via --ignore-platform-reqs produces a bundle that no part of the Laravel request lifecycle ever invokes.
Technical risk — high, on every axis.
Key questions for the requester.
<datalist> may satisfy the latter at lower cost.Stack fit — rewrite, don't integrate. Target Laravel + Eloquent + Blade (or Livewire). The deliverable is a reusable <x-entity-select> component plus a controller action using route model binding, a query scope for the search term, and a capped paginate(). Select2 v4 is the client library; the bundle contributes nothing but naming.
Migration path — none from this package; there is nothing to port. If the organization has Symfony2 applications depending on it, that is a modernization signal: reimplement the same JSON contract (results, pagination.more, id, text) on Symfony 6/7 or Laravel so existing front-end JS keeps working, then retire the bundle. If there is no Symfony2 footprint — and with 0 dependents that is likely — there is no migration at all, only a greenfield build.
Compatibility — incompatible as-is. The bundle's constraints (PHP ~5.5–7.0, Symfony 2.x, Twig 1.x) sit two major PHP versions and three Symfony majors behind anything we would run. The Laravel-native replacement targets PHP 8.2/8.3, Laravel 10/11, Select2 4.1.x — all current and supported.
Sequencing.
name, endpoint, placeholder, initial).Maintenance. Adopting the bundle means owning it: upstream is unmaintained, so every PHP or framework bump becomes our patch. The fork-and-port cost dwarfs the ~2-day reimplementation, and the reimplementation sits on code we already know how to support. Recommendation: do not add the dependency; vendor the idea only.
Support. Community support is nil — a README and nothing else. Internal support burden for the Laravel replacement is low and well-understood; Select2 ajax integration is common knowledge on the team, so no single point of failure.
Scaling. The endpoint is the scaling surface, not the widget. A well-built version uses indexed LIKE 'term%' or a dedicated search column, caps results at ~20–50, and paginates with pagination.more. The failure mode to design against is the naive version: LIKE '%term%' full scans plus serializing an entire table, which degrades nonlinearly on large entity tables. Also watch N+1 when mapping models to {id, text} — use select('id', 'name') explicitly.
Failure modes.
templateResult that injects HTML from the label must escape.Ramp-up. Low for the Laravel-native path — a mid-level engineer ships the component in a sprint. Effectively prohibitive for the bundle path: learning Symfony2 Form extension internals in order to port them to Laravel is high-effort, zero-reuse work.
Verdict. Do not adopt. The package scores 15/100 and the scores are honest: it is an abandoned Symfony2 artifact with no dependents and no Laravel surface area. Capture the interaction pattern, reimplement it natively in ~2 days, and invest the saved effort in endpoint authorization and query limits.
How can I help you explore Laravel packages today?