PHPackages                             ramaid/laravel-route-discovery - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. ramaid/laravel-route-discovery

ActiveLibrary[API Development](/categories/api)

ramaid/laravel-route-discovery
==============================

Auto register routes using PHP attributes

09111PHP

Since Feb 15Pushed 3y agoCompare

[ Source](https://github.com/ramaID/laravel-route-discovery)[ Packagist](https://packagist.org/packages/ramaid/laravel-route-discovery)[ RSS](/packages/ramaid-laravel-route-discovery/feed)WikiDiscussions personal Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Automatically discover routes in a Laravel app
==============================================

[](#automatically-discover-routes-in-a-laravel-app)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c44603be1a8f13ddde6388c64e8422eef4d3a147958a2e371e06907ba5fb735a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f6c61726176656c2d726f7574652d646973636f766572792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-route-discovery)[![Tests](https://github.com/spatie/laravel-route-discovery/workflows/Tests/badge.svg)](https://github.com/spatie/laravel-route-discovery/workflows/Tests/badge.svg)[![Total Downloads](https://camo.githubusercontent.com/b9c02d77e5b7965d532998c372628c9effabcd10963ee6cfd496e5ee69a971e0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d726f7574652d646973636f766572792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-route-discovery)

This package can automatically discover routes for controllers and views in your Laravel application. This isn't an all-in approach. While using use auto discovery, you can still register routes like you're used to.

```
// typically in a routes file

Discover::controllers()->in($whateverDirectoryYouPrefer);
Discover::views()->in($whateverDirectoryYouPrefer);

// other routes
```

Using PHP attributes you can manipulate discovered routes: you can set a route name, add some middleware, or ...

Here's how you would add middleware to a controller whose's route will be auto discovered.

```
namespace App\Http\Controllers;

use Illuminate\Routing\Middleware\ValidateSignature;
use Spatie\RouteDiscovery\Attributes\Route;

class MyController
{
    #[Route(middleware: ValidateSignature::class)]
    public function myMethod() { /* ... */ }
}
```

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/b5b06722846b42e118916ecd11479c8ec17e189d861ebbc0279253795c856ff9/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d726f7574652d646973636f766572792e6a70673f743d32)](https://spatie.be/github-ad-click/laravel-route-discovery)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

Documentation
-------------

[](#documentation)

You'll find full documentation [at the Spatie website](https://spatie.be/docs/laravel-route-discovery).

A note on performance
---------------------

[](#a-note-on-performance)

Discovering routes during each application request may have a small impact on performance. For increased performance, we highly recommend [caching your routes](https://laravel.com/docs/8.x/routing#route-caching) as part of your deployment process.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 82.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0eead96552a2696500bd6eb2148509e7d64a9643f963c476ea04eec812b72b0e?d=identicon)[ramaID](/maintainers/ramaID)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (145 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (12 commits)")[![qisthidev](https://avatars.githubusercontent.com/u/34129273?v=4)](https://github.com/qisthidev "qisthidev (4 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (4 commits)")[![ijpatricio](https://avatars.githubusercontent.com/u/26031459?v=4)](https://github.com/ijpatricio "ijpatricio (2 commits)")[![LeonvanderHaas](https://avatars.githubusercontent.com/u/109749285?v=4)](https://github.com/LeonvanderHaas "LeonvanderHaas (2 commits)")[![nunomaduro](https://avatars.githubusercontent.com/u/5457236?v=4)](https://github.com/nunomaduro "nunomaduro (2 commits)")[![vanyamil](https://avatars.githubusercontent.com/u/16938366?v=4)](https://github.com/vanyamil "vanyamil (1 commits)")[![mukhlish32](https://avatars.githubusercontent.com/u/85531251?v=4)](https://github.com/mukhlish32 "mukhlish32 (1 commits)")[![owenvoke](https://avatars.githubusercontent.com/u/1899334?v=4)](https://github.com/owenvoke "owenvoke (1 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (1 commits)")[![27pchrisl](https://avatars.githubusercontent.com/u/6286310?v=4)](https://github.com/27pchrisl "27pchrisl (1 commits)")

### Embed Badge

![Health badge](/badges/ramaid-laravel-route-discovery/health.svg)

```
[![Health](https://phpackages.com/badges/ramaid-laravel-route-discovery/health.svg)](https://phpackages.com/packages/ramaid-laravel-route-discovery)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
