Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Autoroute Bundle Laravel Package

netgusto/autoroute-bundle

AutoRouteBundle is a Symfony bundle that automatically registers routes for controller actions using convention-based URLs, so you can expose endpoints without editing routing files. It scans your controllers, keeps route definitions close to the code, and simplifies setup with minimal configuration...

View on GitHub
Deep Wiki
Context7

Getting Started

Autoroute is a route-generation bundle: instead of hand-writing an entry in routing.yml for every controller action, you point the bundle at a controller namespace and it derives routes from class/method names. Before adopting it, do three things:

  1. Check compatibility first. This is a single-star, zero-dependent Symfony 2-era bundle. Open composer.json and compare the symfony/framework-bundle and php constraints against your project. On Symfony 4+ (Flex) or PHP 8+, assume you will need to fork or patch it.
  2. Register it the old way. There is no Flex recipe. In a 2.x kernel, add new Netgusto\AutorouteBundle\AutorouteBundle(), to AppKernel::registerBundles(). In a modern app you'd wire it via bundles.php and likely fix deprecations along the way.
  3. Import the routing loader in app/config/routing.yml under a prefix, using the bundle's custom loader type (verify the exact type/loader name in the bundle's Routing/ directory — that is the one piece worth reading the source for).

First use case: take a controller with indexAction, showAction, and editAction and make them reachable at predictable URLs without touching routing.yml. Run php app/console router:debug (or bin/console debug:router on newer Symfony) to see exactly what was generated before you build anything on top of it.

Implementation Patterns

  • Namespace-scoped imports. Import the loader once per controller directory with a shared prefix, mirroring Laravel's Route::resource mindset: one import line covers a whole controller, not one line per action.
  • Explicit routes win. Keep routes you need to guarantee (webhooks, legacy URLs, routes with regex requirements) in a normal routing.yml/attribute definition and only autoroute the CRUD-ish controllers. Generated routes should be the default, not the contract.
  • Incremental migration. Move one controller directory at a time; diff debug:router output before and after so you can see exactly what autoroute added and which existing routes it shadowed.
  • Route naming. Match generated route names against what your templates call (path('foo_show', ...)). If the bundle's naming convention doesn't line up, wrap or alias it rather than editing every template.
  • Cache/clear discipline. Route generation runs at routing/container cache warmup. After adding, renaming, or deleting a controller action, run cache:clear and cache:warmup — otherwise the router keeps serving the stale map.
  • Testing. Write a smoke test that asserts debug:router contains the routes you expect. The bundle ships nothing you can trust, so your own integration check is the only guarantee generation hasn't silently broken.

Gotchas and Tips

  • Bus factor / maintenance. One star, zero dependents, MIT. Treat it as abandonware: read every line of Routing/ and DependencyInjection/ before it touches production, and prefer Symfony's built-in attribute routing if you're on Symfony 5+.
  • Era mismatch. Expect Symfony 2.x idioms: AppKernel, services.yml, PHP 5-style code. Registering it in a Symfony 6/7 app is a porting project, not a composer require.
  • Route collisions and ordering. Convention-driven generation can silently shadow or be shadowed by explicit routes depending on import order. Put the autoroute import last and verify with debug:router --show-controllers.
  • Naming drift becomes URL drift. Rename a controller or action and the public URL changes with it. Anything external linking to those URLs (APIs, emails, docs) breaks. Pin public-facing routes explicitly.
  • Debugging. Use debug:router, debug:router <name>, and inspect the compiled routing cache. There is no bundle-specific debug UI. If a route shows in debug:router but 404s at runtime, suspect a stale cache first.
  • Extension points. The route loader is the seam to customize: subclass or wrap it to change prefixes, names, or defaults, and register that wrapper as a tagged routing loader service rather than forking the bundle.
  • Laravel developer note. The mental model is close to Laravel's implicit resource routing, but Symfony compiles routes at cache warmup rather than resolving per request. Feedback is slower and cache state matters far more than you'd expect coming from php artisan route:list.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle