- Notifications
You must be signed in to change notification settings - Fork4
Scalar OpenAPI References in Laravel
License
scalar/laravel
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Use your OpenAPI documents to render modern API references in Laravel
You can install the package via composer:
composer require scalar/laravel
You can publish the config file with:
php artisan vendor:publish --tag="scalar-config"Optionally, you can publish the views using
php artisan vendor:publish --tag="scalar-views"You’ll need an OpenAPI/Swagger document to render your API reference with Scalar. Here are some packages that help generating those documents:
Once done, you can pass it to Scalar. Just make sure it’s a publicly accessible URL.
<?php// config/scalar.phpreturn [// …'url' =>'/openapi.yaml',// …]
The Scalar API reference may be accessed via the /scalar route. By default, everyone will be able to access this route. However, within your App\Providers\AppServiceProvider.php file, you can overwrite the gate definition. This authorization gate controls access to Scalar in non-local environments. You are free to modify this gate as needed to restrict access to your Horizon installation:
<?phpnamespaceApp\Providers;useApp\Models\User;useIlluminate\Support\Facades\Gate;useIlluminate\Support\ServiceProvider;class AppServiceProviderextends ServiceProvider{publicfunctionboot():void { Gate::define('viewScalar',function (?User$user) {returnin_array($user->email, [// ]); }); }}
composertestPlease seeCHANGELOG for more information on what has changed recently.
Contributions are welcome.
The MIT License (MIT). Please seeLicense File for more information.
About
Scalar OpenAPI References in Laravel
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
