https://github.com/3sidedcube/laravel-redoc
A lightweight package for rendering API documentation using OpenAPI and Redoc.
https://github.com/3sidedcube/laravel-redoc
Last synced: 10 months ago
JSON representation
A lightweight package for rendering API documentation using OpenAPI and Redoc.
- Host: GitHub
- URL: https://github.com/3sidedcube/laravel-redoc
- Owner: 3sidedcube
- License: mit
- Created: 2022-03-06T18:05:00.000Z (over 4 years ago)
- Default Branch: 1.x
- Last Pushed: 2024-05-20T11:39:58.000Z (about 2 years ago)
- Last Synced: 2024-11-11T11:14:11.296Z (over 1 year ago)
- Language: PHP
- Size: 19.5 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel Redoc
[](https://packagist.org/packages/3sidedcube/laravel-redoc)
[](https://packagist.org/packages/3sidedcube/laravel-redoc)

This package provides an easy way for rendering API documentation using OpenAPI and Redoc.
## Installation
You can install the package via composer:
```bash
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:
```php
'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
```bash
composer test
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Credits
- [Ben Sherred](https://github.com/benshered)
- [All Contributors](../../contributors)
## License
Laravel Redoc is open-sourced software licensed under the [MIT license](LICENSE.md).