PHPackages                             x-multibyte/laravel-api-docs - 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. x-multibyte/laravel-api-docs

ActiveLibrary[API Development](/categories/api)

x-multibyte/laravel-api-docs
============================

Laravel API Documentation Generator with multiple UI themes and OpenAPI 3+ support

v1.0.1(10mo ago)04MITPHPPHP ^8.2

Since Jul 6Pushed 10mo agoCompare

[ Source](https://github.com/x-multibyte/laravel-api-doc-generator)[ Packagist](https://packagist.org/packages/x-multibyte/laravel-api-docs)[ RSS](/packages/x-multibyte-laravel-api-docs/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (6)Versions (3)Used By (0)

Laravel API Documentation Generator
===================================

[](#laravel-api-documentation-generator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0197f35679dbfe0709f7258da13e3fbe27572647ed2b3b0e013962eff7d0a6a3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f782d6d756c7469627974652f6c61726176656c2d6170692d646f63732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/x-multibyte/laravel-api-docs)[![GitHub Tests Action Status](https://camo.githubusercontent.com/d75bf9f21e106679e8fe6dbb18e00c41b8beeaf541d53ae205160263f3efa21d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f782d6d756c7469627974652f6c61726176656c2d6170692d646f63732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/x-multibyte/laravel-api-docs/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/8557b0a9ebba86b5a16bdf1d85f8c3f79a0d1f5dbec50dd54b9940b48ccaa977/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f782d6d756c7469627974652f6c61726176656c2d6170692d646f63732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/x-multibyte/laravel-api-docs/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/a6bd48789b9dbbd2ca59a471047032dd7d1adb40a03da2aa9b56474b9aad7bde/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f782d6d756c7469627974652f6c61726176656c2d6170692d646f63732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/x-multibyte/laravel-api-docs)

A comprehensive Laravel package for automatically generating beautiful API documentation from your Laravel routes. Supports multiple UI themes including Swagger UI, ReDoc, and RapiDoc with OpenAPI 3+ specification.

Features
--------

[](#features)

- 🚀 **Automatic Documentation Generation** - Scans your Laravel routes and generates OpenAPI 3+ specifications
- 🎨 **Multiple UI Themes** - Choose from Swagger UI, ReDoc, RapiDoc, or create custom themes
- 📱 **Responsive Design** - Works perfectly on desktop, tablet, and mobile devices
- 🔧 **Highly Configurable** - Extensive configuration options for customization
- 📤 **Export Support** - Export documentation as JSON or YAML files
- 📥 **Import Support** - Import existing OpenAPI specifications
- 🗂️ **Static Generation** - Generate static HTML files for hosting anywhere
- 🧹 **Cleanup Tools** - Built-in commands for managing generated files
- 🔍 **Route Analysis** - Detailed analysis and statistics of your API routes
- 🛡️ **Security Support** - Handles authentication middleware detection
- ⚡ **Performance Optimized** - Caching support for improved performance
- 🧪 **Comprehensive Testing** - Full test suite with factory patterns

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11.0+ or 12.0+
- Symfony YAML component

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

[](#installation)

You can install the package via Composer:

```
composer require x-multibyte/laravel-api-docs
```

### Laravel Auto-Discovery

[](#laravel-auto-discovery)

The package will automatically register its service provider through Laravel's package auto-discovery feature.

### Manual Registration (Optional)

[](#manual-registration-optional)

If you need to manually register the service provider, add it to your `config/app.php`:

```
'providers' => [
    // Other Service Providers
    XMultibyte\ApiDoc\ApiDocsServiceProvider::class,
],
```

Quick Start
-----------

[](#quick-start)

1. **Publish the configuration file:**

```
php artisan api-docs:publish --config
```

2. **Generate your API documentation:**

```
php artisan api-docs:generate
```

3. **View your documentation:**

Visit `http://your-app.test/api-docs` in your browser.

Configuration
-------------

[](#configuration)

The configuration file will be published to `config/api-docs.php`. Here are the key configuration options:

```
return [
    // Basic API information
    'title' => 'My API Documentation',
    'version' => '1.0.0',
    'description' => 'Comprehensive API documentation',

    // Route configuration
    'route_prefix' => 'api-docs',
    'middleware' => ['web'],

    // Default theme
    'default_theme' => 'swagger',

    // Route scanning
    'scan_routes' => [
        'prefix' => 'api',
        'exclude' => ['telescope', 'horizon']
    ],

    // OpenAPI configuration
    'openapi' => [
        'version' => '3.0.3',
        'servers' => [
            [
                'url' => env('APP_URL'),
                'description' => 'Development server'
            ]
        ]
    ]
];
```

Available Commands
------------------

[](#available-commands)

### Generate Documentation

[](#generate-documentation)

Generate API documentation from your Laravel routes:

```
# Basic generation
php artisan api-docs:generate
```

```
# Generate with specific format
php artisan api-docs:generate --format=yaml
```

```
# Generate both JSON and YAML
php artisan api-docs:generate --format=both
```

```
# Generate with validation
php artisan api-docs:generate --validate
```

```
# Generate specific routes only
php artisan api-docs:generate --routes="api/users/*,api/posts/*"
```

```
# Exclude specific routes
php artisan api-docs:generate --exclude="api/admin/*"
```

### Import Documentation

[](#import-documentation)

Import existing OpenAPI specifications:

```
# Import from JSON file
php artisan api-docs:import openapi.json
```

```
# Import with validation and backup
php artisan api-docs:import openapi.yaml --validate --backup
```

```
# Merge with existing specification
php artisan api-docs:import openapi.json --merge
```

### Generate Static Files

[](#generate-static-files)

Generate static HTML documentation files:

```
# Generate static files for all themes
php artisan api-docs:static
```

```
# Generate specific themes
php artisan api-docs:static --themes=swagger,redoc
```

```
# Generate with custom output path
php artisan api-docs:static --output=/path/to/output
```

```
# Generate minified HTML
php artisan api-docs:static --minify
```

```
# Generate with custom base URL
php artisan api-docs:static --base-url=https://docs.example.com
```

### Clean Up Files

[](#clean-up-files)

Clean up generated documentation files:

```
# Clean all files (dry run)
php artisan api-docs:clean --all --dry-run
```

```
# Clean backup files older than 7 days
php artisan api-docs:clean --backups --older-than=7
```

```
# Clean cache files
php artisan api-docs:clean --cache
```

```
# Clean generated files
php artisan api-docs:clean --generated
```

### Check Status

[](#check-status)

View documentation status and statistics:

```
# Basic status
php artisan api-docs:status
```

```
# Detailed status with route analysis
php artisan api-docs:status --detailed

# Show route analysis only
php artisan api-docs:status --routes

# Show file information only
php artisan api-docs:status --files
```

### Publish Assets

[](#publish-assets)

Publish package files for customization:

```
# Publish all files
php artisan api-docs:publish --all

# Publish configuration only
php artisan api-docs:publish --config

# Publish views only
php artisan api-docs:publish --views

# Publish assets only
php artisan api-docs:publish --assets
```

### Get Help

[](#get-help)

Display help information:

```
php artisan api-docs:help
```

Themes
------

[](#themes)

### Swagger UI

[](#swagger-ui)

The default theme using Swagger UI for interactive API documentation.

**Features:**

- Interactive API testing
- Request/response examples
- Schema visualization
- Authentication support

### ReDoc

[](#redoc)

Beautiful, responsive API documentation with ReDoc.

**Features:**

- Clean, modern design
- Three-panel layout
- Advanced search functionality
- Customizable themes

### RapiDoc

[](#rapidoc)

Modern API documentation with RapiDoc.

**Features:**

- Multiple layout options
- Built-in API testing
- Customizable styling
- Advanced filtering

### Custom Theme

[](#custom-theme)

Create your own custom theme by extending the base theme system.

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

[](#advanced-usage)

### Custom Route Detection

[](#custom-route-detection)

You can customize how routes are detected and processed:

```
// In your configuration
'scan_routes' => [
    'prefix' => 'api',
    'exclude' => [
        'telescope',
        'horizon',
        'debugbar',
        '_ignition'
    ],
    'include_middleware' => [
        'api',
        'auth:api',
        'auth:sanctum'
    ]
]
```

### Security Configuration

[](#security-configuration)

Protect your documentation with authentication:

```
'security' => [
    'enabled' => true,
    'middleware' => ['auth'],
    'allowed_ips' => ['127.0.0.1'],
    'basic_auth' => [
        'enabled' => true,
        'username' => env('API_DOCS_USERNAME'),
        'password' => env('API_DOCS_PASSWORD')
    ]
]
```

### Caching

[](#caching)

Enable caching for better performance:

```
'cache' => [
    'enabled' => true,
    'ttl' => 3600, // 1 hour
    'key_prefix' => 'api_docs',
    'store' => 'redis'
]
```

### Static File Generation

[](#static-file-generation)

Generate static files for deployment:

```
'static' => [
    'output_path' => storage_path('api-docs/static'),
    'base_url' => 'https://docs.example.com',
    'themes' => ['swagger', 'redoc'],
    'minify_html' => true,
    'include_assets' => true,
    'generate_sitemap' => true
]
```

Testing
-------

[](#testing)

The package includes a comprehensive test suite:

```
# Run all tests
composer test
```

```
# Run tests with coverage
composer test-coverage
```

```
# Run code style checks
composer cs-check
```

```
# Fix code style issues
composer cs-fix
```

```
# Run all quality checks
composer test-all
```

### Using Test Factories

[](#using-test-factories)

The package includes factory classes for testing:

```
use XMultibyte\ApiDoc\Tests\Concerns\UsesFactories;

class MyTest extends TestCase
{
    use UsesFactories;

    public function test_something()
    {
        $spec = $this->createOpenApiSpec();
        $route = $this->createRoute('GET', 'api/users');

        // Your test logic here
    }
}
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details on how to contribute to this project.

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

[](#security-vulnerabilities)

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

Credits
-------

[](#credits)

- [X-Multibyte](https://github.com/x-multibyte)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Support
-------

[](#support)

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

For general support and questions, please use the [GitHub Discussions](https://github.com/x-multibyte/laravel-api-docs/discussions) or open an issue on [GitHub](https://github.com/x-multibyte/laravel-api-docs/issues).

Roadmap
-------

[](#roadmap)

- GraphQL support
- API versioning support
- Advanced authentication schemes
- Custom annotation support
- Integration with popular API testing tools
- Multi-language documentation support
- Advanced caching strategies
- Real-time documentation updates

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance54

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% 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 ~0 days

Total

2

Last Release

310d ago

PHP version history (2 changes)v1.0.0PHP ^8.1

v1.0.1PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/4e9c51ad711300e5d3648a54d2015000a16bd15d95bbadbf111781d3f709aa5d?d=identicon)[x-multibyte](/maintainers/x-multibyte)

---

Top Contributors

[![v0[bot]](https://avatars.githubusercontent.com/u/215908095?v=4)](https://github.com/v0[bot] "v0[bot] (11 commits)")[![x-multibyte](https://avatars.githubusercontent.com/u/141466107?v=4)](https://github.com/x-multibyte "x-multibyte (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/x-multibyte-laravel-api-docs/health.svg)

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

###  Alternatives

[darkaonline/l5-swagger

OpenApi or Swagger integration to Laravel

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

The Statamic CMS Core Package

4.8k3.2M720](/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)
