mikegarde/laravel-route-docs

A Laravel package that uses PHP attributes to document routes, generate readable route listings, and export OpenAPI or Postman definitions.
2,247
Install
composer require mikegarde/laravel-route-docs
Latest Version:1.1.0
PHP:^8.1
License:GPL-3.0-only
Last Updated:Jul 9, 2025
Links: GitHub  ·  Packagist
Maintainer: MikeGarde

Laravel Route Docs

Latest Version on Packagist codecov GitHub Tests Action Status License: GPL v3

A Laravel package that uses PHP attributes to document routes, generate readable route listings, and export OpenAPI or Postman definitions.


Features

  • Document routes directly using PHP attributes
  • Validate route documentation in your CI/CD pipeline
  • Includes CLI tooling for discovery and inspection

TODO:

  • Add request parameters
  • Add response schemas
  • Export route definitions as JSON, OpenAPI, or Postman collections

Installation

composer require mikegarde/laravel-route-docs --dev

Usage

Annotate your controller methods using custom attributes to describe your API:

use RouteDocs\Attributes\get;

class ItemController
{
    #[get('/items', name: 'items.index')]
    public function index()
    {
        return Item::all();
    }
}

Then run:

php artisan route:docs

You’ll get a structured view of your documented routes.

Validate Route Attributes in CI/CD

You can validate that all routes have correct and complete attribute annotations:

php artisan route:docs:validate

This will return non-zero exit codes on failure, making it CI-friendly.

Related Packages

samody/laravel-smart-postman-generator

A smart Laravel-to-Postman collection generator focused on clean structure, smar...

1,948 1
oybek-daniyarov/laravel-trpc

End-to-end type-safe APIs for Laravel. Like tRPC, but for Laravel + TypeScript.

274 0
lord/laroute

Access Laravels URL/Route helper functions, from JavaScript.

2,030,740 785
mariuzzo/laravel-translator

Laravel command that interactively helps you translate missing keys.

39,907 19
maartenstaa/laravel-41-route-caching

This package allows you to cache your routes definitions, thereby speeding up ea...

386,174 25