Skip to content

OpenAPI ​

Use an OpenAPI file as the source of your routes instead of reading them from Laravel. Nimbus lists the operations of the file and uses its schemas for the request body.

Prerequisites ​

  • An OpenAPI specification file in YAML or JSON.
  • The package that reads the file.
Terminal
composer require devizzent/cebe-php-openapi

Steps ​

  1. Open config/nimbus.php and set the strategy of the application.

    php
    'routes' => [
        'strategy' => 'openapi',
        'openapi' => [
            'files' => [
                'default' => base_path('docs/openapi.yaml'),
            ],
            'show_operation_id' => true,
        ],
    ],
  2. For a versioned API, set 'versioned' => true and use one file for each version. The keys must match the version segments of your routes.

    php
    'files' => [
        'v1' => base_path('docs/v1/openapi.yaml'),
        'v2' => base_path('docs/v2/openapi.json'),
    ],
  3. Reload Nimbus. The operations of the file appear in the sidebar.

OpenAPI support

Show operation IDs ​

Set show_operation_id to true to show the operation ID of each route in the sidebar instead of the short path. You can search routes by route name and by operation ID.

Routes that are not in the file ​

  • A route in Laravel but not in the file is added, and Nimbus shows a Route is auto-detected notice. This lets you test a route before you document it.
  • A route in the file but not in Laravel shows a Route not found banner. Clear your route cache or sync your branch.