Weave Code
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

Laravel Route Discovery Laravel Package

spatie/laravel-route-discovery

Automatically discover Laravel routes by scanning controllers and views instead of manually defining them. Configure discovery in your routes files and use PHP attributes to customize names, middleware, and more for each discovered route.

View on GitHub
Deep Wiki
Context7

title: Getting started weight: 1

This package can automatically discover and register routes for a directory containing controllers.

Via the routes file

You can enable route discovery via the routes file.

// in a routes file

use Spatie\RouteDiscovery\Discovery\Discover;

Discover::controllers()->in(app_path('Http/Controllers'));

Via the config file

Alternatively, you can discover routes using the config file.

First, you need to publish the config file. This will create a file at config/route-discovery.php

php artisan vendor:publish --tag="route-discovery-config"

In the discover_controllers_in_directory key of the route-discovery config file, you can specify a directory that contains controllers.

Here you can uncomment the line to register controllers in the app_path('Http/Controllers') directory. Of course you can use any directory you want.

// config/route-discovery

/*
 * Routes will be registered for all controllers found in
 * these directories.
 */
'discover_controllers_in_directory' => [
    app_path('Http/Controllers'),
],
// ...
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport