Documentation UI renderers

New in 0.13.25

Scramble renders the same OpenAPI document with either Stoplight Elements or Scalar. Elements is the default.

Choose a renderer

Set renderer in config/scramble.php:

'renderer' => 'scalar',

This changes only the documentation UI; the generated OpenAPI document is unchanged.

Configure a renderer

Options live under renderers and are passed to the selected UI:

'renderers' => [
'elements' => [
'theme' => 'dark',
'hideTryIt' => false,
],
'scalar' => [
'theme' => 'laravel',
'darkMode' => true,
'credentials' => 'include',
],
],

See the Elements configuration reference and Scalar configuration reference for the available options. For Sanctum cookie authentication, leave Scalar’s credentials set to include.

Use a different renderer per API

Override the renderer when registering an API:

Scramble::registerApi('public', [
'renderer' => 'scalar',
]);
Scramble::registerApi('internal', [
'renderer' => 'elements',
]);
Scramble PRO
Comprehensive API documentation generation for Spatie’s Laravel Data, Laravel Query Builder, and other packages.