appwise-labs/laravel-docs

OpenApi documentation for Laravel projects with web viewer

Installs: 526

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 4

Forks: 0

Language:Blade

Type:laravel

v0.1.3 2023-07-05 14:46 UTC

This package is auto-updated.

Last update: 2024-05-05 16:28:10 UTC


README

Introduction

Installation

Require the package with Composer:

composer require appwise-labs/laravel-docs

This packages uses Laravel's autodiscovery:

If this doesn't work correctly for some reason, you can manually add the ServiceProvider to your config/app.php.

'providers' => [
    //...
    AppwiseLabs\LaravelDocs\LaravelDocsServiceProvider::class
];

Finally, publish the default config file config/laravel-docs.php using

php artisan laravel-docs:install

or

php artisan vendor:publish --provider="AppwiseLabs\LaravelDocs\LaravelDocsServiceProvider" --tag="config"

Usage

Basic usage

Put your openapi.yaml file in resources/docs/openapi.yaml and run This path can be changed using the config/laravel-docs.php config file. The default route to view your docs is /docs.

Gate

By default, the docs are only accessible in the local environment. You can change this by using the gate canViewDocs in your App\Providers\AuthServiceProvider file. For example:

Gate::define('canViewDocs', function ($user = null) {
    return true;
});