3sidedcube/laravel-redoc

A lightweight package for rendering API documentation using OpenAPI and Redoc.
38,483 5
Install
composer require 3sidedcube/laravel-redoc
Latest Version:v1.0.1
PHP:^7.4|^8.0|^8.1|^8.2|^8.3
Laravel:8 – 11
License:MIT
Last Updated:Jan 22, 2026
Links: GitHub  ·  Packagist
Maintainer: 3sidedcube

Laravel Redoc

Latest Version on Packagist Total Downloads GitHub Actions

This package provides an easy way for rendering API documentation using OpenAPI and Redoc.

Requirements

  • PHP 7.4 or higher
  • Laravel 8.0 or higher

Composer will automatically ensure compatible versions:

  • PHP 7.4: Works with Laravel 8
  • PHP 8.0: Works with Laravel 8-9
  • PHP 8.1: Works with Laravel 8-10
  • PHP 8.2+: Works with Laravel 8-13

Installation

You can install the package via composer:

composer require 3sidedcube/laravel-redoc

Usage

Viewing the documentation

By default, the documentation is served at /docs/api and will load the openapi.json file from the openapi folder at the root of the project.

You can change the path used to serve the documentation by setting the redoc.path config option.

If you would like to change the directory where your openapi.json file is located, you can update redoc.directory config option.

Documentation versions

Laravel Redoc supports rendering multiple versions of documentation. If you would like to serve a different version of the documentation, you can include {version} in the redoc.path config option e.g. docs/{version}/api. This will then load the {version}.json file from the configured directory.

Variables

If you would like to replace a "variable" in the documentation, you can use the redoc.variables config option.

For example, if you would like to dynamically set the server url to the given environment, you could configure the following variable:

'variables' => [
    'server_url' => env('APP_URL'),
],

Now, when you use :server_url in the OpenAPI definition, it will be replaced with the value of the APP_URL.

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

Laravel Redoc is open-sourced software licensed under the MIT license.

Related Packages

3sidedcube/laravel-api-errors

A lightweight package for handling API error responses.

15,572 4
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

644,549,754 9,698
laravel/framework

The Laravel Framework.

598,760,099 34,966
laravel/tinker

Powerful REPL for the Laravel framework.

507,193,856 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

423,477,751 607

Version History

Version Released PHP Laravel License
v1.0.1 ^7.4|^8.0|^8.1|^8.2|^8.3 ^8.0|^9.0|^10.0|^11.0 MIT
v1.0.0 ^7.4|^8.0 ^8.0|^9.0 MIT