PHP code example of alexkramse / filament-openapi-docs
1. Go to this page and download the library: Download alexkramse/filament-openapi-docs library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alexkramse / filament-openapi-docs example snippets
namespace App\Providers\Filament;
use Alexkramse\FilamentOpenapiDocs\FilamentOpenApiDocsPlugin;
use Filament\Panel;
use Filament\PanelProvider;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugin(FilamentOpenApiDocsPlugin::make());
}
}
use Alexkramse\FilamentOpenapiDocs\FilamentOpenApiDocsPlugin;
FilamentOpenApiDocsPlugin::make()
->slug('developer/api-docs')
->navigationLabel('OpenAPI')
->navigationIcon('heroicon-o-document-text')
->navigationGroup('Developer')
->navigationSort(100)
->navigationBadge('count')
->navigationBadgePrefix('')
->navigationBadgeSuffix(' endpoints')
->subNavigationPosition('right')
->title('API Documentation')
->description('Browse and test available API endpoints.')
->enabledInProduction()
->fullWidth()
->requestSamples()
->developerOptions()
->defaultServer('https://api.example.com')
->versions(['v1', 'v2']);
use Alexkramse\FilamentOpenapiDocs\Support\SpecProvider;
use Dedoc\Scramble\GeneratorConfig;
class CustomSpecProvider implements SpecProvider
{
public function config(): GeneratorConfig
{
// Return the generator config used by the docs renderer.
}
public function view(): string
{
// Return the renderer view name used by the spec provider.
}
public function spec(): array
{
// Return the OpenAPI document as an array.
}
}