php-nl/laravel-api-doc

Highly configurable Laravel API documentation generator

Maintainers

Package info

github.com/Php-nl/laravel-api-docs

pkg:composer/php-nl/laravel-api-doc

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-03-24 21:00 UTC

This package is auto-updated.

Last update: 2026-03-24 21:00:21 UTC


README

Laravel API Doc

A highly configurable, beautiful, and interactive API documentation generator for Laravel.

Latest Version on Packagist PHP from Packagist Total Downloads License

Laravel API Doc is an elegant, zero-configuration API documentation package designed to give your Laravel projects a beautiful, Stoplight Elements-inspired interactive dashboard out of the box.

It automatically parses your routes, form requests, and parameters to generate a live, testable documentation portal where you and your team can try out endpoints seamlessly.

โœจ Features

  • Beautiful UI: A premium, fully responsive 3-column layout built with Livewire and Tailwind CSS.
  • Interactive "Try It Out" Panel: Test any endpoint directly from your browser.
  • Global Authentication: Configure Bearer Tokens, Basic Auth, or API Keys directly from the dashboard to authenticate your test requests.
  • Auto-Discovery: Automatically detects endpoints, methods, and route groups.
  • Zero Config Required: Just install and visit /docs/api!

๐Ÿ“ฆ Installation

You can install the package via composer:

composer require php-nl/laravel-api-doc

Next, you can publish the configuration file and assets using:

php artisan vendor:publish --provider="PhpNl\LaravelApiDoc\LaravelApiDocServiceProvider"

๐Ÿš€ Usage

Once installed, simply navigate to the predefined documentation route in your browser:

http://your-app.test/docs/api

You will be greeted by the API Documentation Dashboard. From here you can:

  1. Browse through your API routes logically grouped by domain.
  2. View the description, parameters, and required payloads for each route.
  3. Use the Security & Authentication configuration to authenticate globally.
  4. Execute real-time requests against your application.

Defining Endpoints

The package leverages Laravel's native routing metadata and reflection to parse documentation. Standard PHPDoc blocks, FormRequest validations, and route groupings are automatically extracted to document your API.

Global Authentication

When interacting with private APIs, you don't need to manually enter tokens for every request. On the Welcome Screen of the documentation dashboard, use the Security & Authentication panel to define yours:

  • Bearer Token
  • Basic Auth
  • API Key (Header or Query Parameter)

Once set, this authentication state is persisted for your session and can be toggled per-endpoint when running test queries.

โš™๏ธ Configuration

You can fully customize the look and feel, available themes, and base extraction rules by modifying the published configuration file at config/laravel-api-doc.php.

return [
    'ui' => [
        'title' => 'My API Documentation',
        'theme' => [
            'primary_color' => '#3b82f6', // Customize your brand color!
            'background_color' => '#f8fafc',
        ],
    ],
    // ...
];

๐Ÿงช Testing

composer test

๐Ÿ›  Contributing

Please see CONTRIBUTING for details.

๐Ÿ”’ Security Vulnerabilities

If you discover any security-related issues, please email directly instead of using the issue tracker.

๐Ÿ“„ License

The MIT License (MIT). Please see License File for more information.