elnur/template-guesser-bundle
Symfony bundle that automatically guesses which template to render, so you don't have to wire template paths by hand. It applies naming conventions to pick the right view for a request, keeping controller code lean and templates predictable.
Architecture fit
Elnur\TemplateGuesserBundle with a bundle class, DI extension, and a service override targeting Symfony's full-stack event pipeline (Symfony 2.x era). There is no service provider, facade, config publish tag, or anything Laravel auto-discovers.TemplateGuesser behind SensioFrameworkExtraBundle's TemplateListener (via sensio_framework_extra.view.guesser) so a bare @Template annotation resolves to a bundle-internal view. The documented behavior is turning AcmeDemoBundle:Default:index.html.twig into Default/index.html.twig so the Twig loader can find it under app/Resources/views/.view(), Response::view, resource-controller conventions). Laravel consumes Symfony components (http-foundation, routing, console), but not the HttpKernel controller-resolution/event pipeline this package hooks into.Integration feasibility
~2.x constraints that conflict with the Symfony components Laravel 9/10/11 pull in. Even a "it installed" result should be treated as a red flag, not a green light.ResponseFactory macro, or a small TemplateNameResolver class. Buy-vs-build is decisively "build."Technical risk
Key questions
return view(...), or matching an existing convention from an app we're porting?Stack fit
App\Http\Controllers\Billing\InvoiceController@show to the view billing.invoice.show — into an in-house resolver behind an interface so controllers never hardcode paths and the convention can be swapped or deleted in one place.#[Template('...')] values or a guesser implementing the current TemplateGuesserInterface.Migration path
composer.json. Write the decision down so it isn't re-litigated next quarter.TemplateNameResolver interface with one or two pilot controllers. Keep explicit view() calls legal — the convention should be an opt-in default, not a mandate.Compatibility
>=5.3-era syntax; unvalidated against PHP 8.x.~2.x component constraints; hard conflict with Laravel 9+ and Symfony 5+.AcmeDemoBundle:Foo:bar.html.twig), removed in Twig 2 / Symfony 3 in favor of @AcmeDemo/Foo/bar.html.twig.doctrine/annotations: deprecated and being removed from modern stacks.Sequencing
Maintenance
Support
Scaling
Failure modes
composer update anywhere in the tree fails or silently downgrades shared Symfony components.view() calls, leaving two coexisting patterns and no stated rule.Ramp-up
How can I help you explore Laravel packages today?