rollerworks/route-autowiring-bundle
Symfony bundle that automatically wires routes to controller actions using convention-based discovery, reducing manual routing configuration. It integrates with Symfony’s router to register controllers and supports customizable prefixes and namespaces.
Install (with care). composer require rollerworks/route-autowiring-bundle. The package is archived and last released in late 2019, so confirm it installs against your Symfony/PHP version before committing. If Composer resolves but the app fails to boot, treat that as your first signal to fall back to native routing.yaml imports.
Register the bundle manually. There is no Flex recipe for this graveyard package. Add it to config/bundles.php:
return [
// ...
Rollerworks\Bundle\RouteAutowiringBundle\RollerworksRouteAutowiringBundle::class => ['all' => true],
];
Read the config tree before writing config. The single most useful file in the repo is src/DependencyInjection/Configuration.php. It defines exactly which keys (resource, prefix, name_prefix, type, etc.) your installed version accepts. Open it first; the README is thin and has drifted from the tagged code.
Add your first autowiring entry in config/packages/rollerworks_route_autowiring.yaml:
rollerworks_route_autowiring:
autowire:
app:
resource: '%kernel.project_dir%/src/Controller'
type: annotation
First real use case: stop editing config/routes.yaml every time you add a controller directory or a new module bundle. Point one autowire entry at the directory (or glob) and let the bundle fan the import out at cache-warmup time. Verify with bin/console debug:router that the expected routes appear.
Clear the cache. bin/console cache:clear after every config change. The bundle resolves resources during container/route compilation, not on each request, so a stale cache will make you think the config is broken.
One entry per logical module. Give each bundle or app section its own named autowire key (app, admin, api) so prefix/name-prefix rules stay scoped and you can disable one without touching the others:
rollerworks_route_autowiring:
autowire:
app:
resource: '%kernel.project_dir%/src/Controller'
type: annotation
prefix: /
admin:
resource: '%kernel.project_dir%/src/Controller/Admin'
type: annotation
prefix: /admin
name_prefix: admin_
Use globs for cross-cutting concerns. resource: '%kernel.project_dir%/src/Module/*/Controller' is the idiomatic replacement for the stack of per-module imports you would otherwise hand-maintain. Keep the pattern narrow enough that it doesn't sweep up fixtures or tests.
Parallel-run migration. While you gain confidence, keep the existing routing.yaml imports and add the autowire entry alongside, with a name_prefix or prefix that keeps it in a separate URL space. Once debug:router shows parity, delete the manual imports. This is the only sane way to introduce a dormant, unmaintained bundle into a live app.
Environment-scoped config is your kill switch. Because each autowire block is a config node, you can drop it from config/packages/test/rollerworks_route_autowiring.yaml (or set the resource to an empty directory) to isolate it to prod/dev. This is the cheapest escape hatch if the bundle misbehaves under a specific test harness.
Treat it as a compile-time route loader. The integration point is the routing loader/compiler pass — Symfony’s route collection is assembled by importing whatever the autowire blocks expand to. That means it composes with routing.yaml imports in either direction; ordering follows the order in which entries are processed, so put manual imports first if you need them to win on duplicate names.
Name prefixes are the collision fix. Route name collisions from directory scans are the most common failure mode. Set name_prefix per block rather than relying on controller naming discipline.
Archived + 2019 release = annotation-era assumptions. The bundle predates PHP 8 attributes and Symfony’s move away from annotation route loading. On Symfony 6+, type: annotation may not load attributes at all. Check what type values the loader accepts in your installed version; if only annotation is supported, this bundle will not see #[Route] controllers and you should not adopt it for new projects.
No Flex recipe, no auto-registration, no bin/console discoverability. Anything that relies on Flex (bundle registration, config file scaffolding, composer.json allow-plugins prompts) will not happen for you. Manual registration in bundles.php is mandatory.
Config changes require a cache clear. The resource expansion happens during container/route compilation. Adding a controller to an autowired directory does nothing until cache:clear (or cache:warmup). Developers coming from runtime loaders will lose an hour to this.
Glob patterns are evaluated at warmup, not per request. src/Module/*/Controller does not mean "watch for new modules" — it means "whatever matched at cache warmup". In CI, always warm the cache from a clean checkout.
Debug with debug:config, not with the router alone. bin/console debug:config rollerworks_route_autowiring shows the merged config tree, which is the fastest way to confirm your keys were accepted rather than silently ignored (unrecognized keys throw during compilation, but wrong nesting can be subtle). Then debug:router confirms the resulting routes.
Prefix concatenation and trailing slashes are easy to double up. If your existing routing.yaml already applies a prefix to an imported file and you add an autowire prefix on top of it, you get /admin/admin/.... Keep prefixes in exactly one place.
Route name collisions surface late. Two controllers with the same class short name in different autowired directories will clash. debug:router will list both, but the second import overwrites the first silently in some Symfony versions. Give every block a distinct name_prefix.
Extension points are thin. The useful customisation surface is the config tree and, at the edge, overriding the bundle’s routing loader service with your own. There is no maintained plugin API and no issue tracker activity, so treat any service override as a fork you now own — copy the relevant service definition into your app rather than subclassing in place.
Budget for replacing it. Given the archive status and zero dependents, the realistic long-term plan is native routing.yaml imports plus type: attribute on controller directories. Treat the autowiring config as a migration accelerator, not a permanent fixture, and keep your entries in one file so the eventual removal is a single diff.
How can I help you explore Laravel packages today?