- How do I install izniburak/laravel-auto-routes in a Laravel application?
- Install it with composer require izniburak/laravel-auto-routes. Laravel package discovery registers the service provider automatically, then you publish the package config and point it at the controller namespace you want scanned. No manual routes/web.php entries are required for the controllers it discovers.
- Which Laravel and PHP versions does izniburak/laravel-auto-routes support?
- The package's composer.json version constraints are the authoritative answer, so check them against your Laravel and PHP versions before adopting it. The technical evaluation notes that Laravel-version tracking and CI verification are not clearly demonstrated, and the latest release was in August 2024. Test the package on your exact Laravel version in a branch before relying on it.
- How does laravel-auto-routes turn controller method names into routes?
- It scans controller classes under the namespaces you configure and derives routes from the controller and method names, so methods such as getIndex or postStore map to matching URIs and HTTP verbs. The convention replaces explicit Route::get and Route::post declarations for those controllers. You point the config at your controller namespace and the package registers the routes during the service provider boot cycle.
- Does laravel-auto-routes work with php artisan route:cache?
- The package advertises route caching support, but discovery must run identically at cache time and at runtime or the cached table can diverge from the real route surface. Always run route:cache and route:list in staging after a deploy and confirm the discovered endpoints match what you expect. A stale cache can make endpoints disappear or persist after they should have been removed.
- Can I apply middleware, prefixes, route groups, and domains to auto-generated routes?
- The package supports middleware, prefixes, and namespaces, so you can wrap discovered routes in the same concerns as explicit ones. The trade-off is visibility: per-route middleware, throttle policies, and domain constraints are harder for reviewers to see than they are in routes/web.php. Keep the grouping configuration in version control and review changes to it like route changes.
- What happens when two controllers resolve to the same URI in laravel-auto-routes?
- Conflict resolution is implicit and depends on registration order, so precedence is hard to reason about and harder to catch in code review. Give each controller a distinct prefix or namespace so collisions cannot occur. Treat any duplicate URI as a design error rather than relying on ordering.
- Is laravel-auto-routes safe to use in production?
- It can be, but the main risk is silent route surface expansion: any public controller method that matches the discovery pattern becomes a live endpoint without an explicit declaration. That makes adoption safest in greenfield modules and risky in legacy codebases with god-controllers or helper methods on controllers. Audit the discovered route list with route:list before every release and avoid exposing controllers with debug or internal methods.
- How do I stop a controller method from being auto-routed?
- Discovery is pattern-based, so the practical controls are renaming the method, reducing its visibility to protected or private, or excluding the controller through configuration. The evaluation flags that an explicit allow-list for routable methods is not confirmed, so confirm the package's exclusion options in its config and README first. Never leave a debug or helper method public on a discovered controller.
- Is laravel-auto-routes a good fit for APIs and versioned public contracts?
- Generally no. Implicit discovery inverts Laravel's explicit, auditable route contract, which is exactly what versioned public APIs and SLA-bound services need. It fits CRUD-heavy monoliths, internal admin panels, and convention-based API scaffolding where the route surface is large and stable. For public contracts, prefer explicit route files or attribute-based routing with static analysis support.
- How actively maintained is izniburak/laravel-auto-routes, and what is the bus factor?
- The project has around 234 GitHub stars and a low composite score, which suggests limited battle-testing compared with mainstream Laravel packages. A release in August 2024 is recent but does not by itself prove a maintainership cadence, and you should plan for the possibility of a single maintainer. Pin the version in composer.json and be prepared to fork if you adopt it in a long-lived application.