PHPackages                             mindedge/laravel-api-doc - 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. mindedge/laravel-api-doc

ActivePackage[API Development](/categories/api)

mindedge/laravel-api-doc
========================

Automatically parse laravel api routes and store them in an OpenAPI compatible format

0.1.2(8mo ago)01.3k↓25%MITPHP

Since Jun 13Pushed 8mo agoCompare

[ Source](https://github.com/mindedge/laravel-api-doc)[ Packagist](https://packagist.org/packages/mindedge/laravel-api-doc)[ RSS](/packages/mindedge-laravel-api-doc/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

Laravel-Api-Doc
===============

[](#laravel-api-doc)

Automatically create documentation for Laravel api's off the registered routes and [PHPDoc comments](https://www.phpdoc.org/)

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [How it works](#how-it-works)
- [Usage](#usage)
- [Advanced Usage](#advanced-usage)
- [License](#license)

---

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require jrogaishio/laravel-api-doc
```

How it works
------------

[](#how-it-works)

Take the below example route url and controller method:

POST Request: `/1.0/pages/1234/posts`

```
// PostController.php

/**
 * Create a new post
 * @param PostCreateRequest $request
 * @param int $page_id The page to create this post on
 */
public function create(PostCreateRequest $request, int $page_id)
{
    $post = Post::create([
        'page_id' => $page_id,
        'title' => 'My Sample Post',
        'body' => 'Hello world!',
    ]);

    return response($post, 201);
}
```

This library will scan the registered Laravel routes, and see that `/1.0/pages/1234/posts` is registered to `PostController@create`.

It will then scan the `create` method definition for route parameters. This is so we always grab the true parameter list even if the PHPDoc comments don't include them.

If the first parameter is an instance of `Illuminate\Foundation\Http\FormRequest` we will scan the class for a `rules()` method to build a list of the form/query parameters.

The we will continue parsing the controller `create` method to get the route parameters. In this example we have `$page_id` so we will check the PHPDoc comments to grab a description of what this parameter does.

Usage
-----

[](#usage)

Basic Usage:

```
use Jrogaishio\LaravelApiDoc\Doc;

// The base api path (typically the version) to scan for routes
// Doc::generate() defaults to '1.0'
$baseApiPath = '1.0';
$document = Doc::generate($baseApiPath);

// toOpenApi defaults to OpenApi version 3.0.3 and an export type of yaml
echo $document->toOpenApi();
```

Get the routes as an OpenApi json object:

```
use Jrogaishio\LaravelApiDoc\Doc;

$document = Doc::generate('1.0');
print_r($document->toOpenApi(format: 'json'));
```

Get the routes as an OpenApi php array:

```
use Jrogaishio\LaravelApiDoc\Doc;

$document = Doc::generate('1.0');
print_r($document->toOpenApi(format: 'array'));
```

Advanced Usage
--------------

[](#advanced-usage)

You can supply a partially pre-filled document to `Doc::generate()` to set default values

```
use Jrogaishio\LaravelApiDoc\Doc;
use Jrogaishio\LaravelApiDoc\Global\Document;

$baseDocument = new Document([
    'name' => 'My Awesome Api',
    'description' => 'The Awesome API Documentation',
    'license' => ['name' => '', 'url' => ''],
    'contact' => 'support@example.com',
    'version' => '1.0'
]);
$document = Doc::generate(doc: $baseDocument);

echo $document->toOpenApi();
```

License
-------

[](#license)

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

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance64

Regular maintenance activity

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 87.5% 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.

###  Release Activity

Cadence

Every ~440 days

Total

2

Last Release

254d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a8bdc9f0c41d19ed030f8d105872f76d80cd0003ece1ed706e5756073a694ac0?d=identicon)[mindedge](/maintainers/mindedge)

---

Top Contributors

[![JRogaishio](https://avatars.githubusercontent.com/u/3596964?v=4)](https://github.com/JRogaishio "JRogaishio (14 commits)")[![tcedge](https://avatars.githubusercontent.com/u/26552977?v=4)](https://github.com/tcedge "tcedge (2 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/mindedge-laravel-api-doc/health.svg)

```
[![Health](https://phpackages.com/badges/mindedge-laravel-api-doc/health.svg)](https://phpackages.com/packages/mindedge-laravel-api-doc)
```

###  Alternatives

[darkaonline/l5-swagger

OpenApi or Swagger integration to Laravel

2.9k34.0M111](/packages/darkaonline-l5-swagger)[statamic/cms

The Statamic CMS Core Package

4.8k3.2M718](/packages/statamic-cms)[knuckleswtf/scribe

Generate API documentation for humans from your Laravel codebase.✍

2.3k12.2M45](/packages/knuckleswtf-scribe)

PHPackages © 2026

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