Skip to content

Plugins ​

Plugins that ship with other packages. Each one adds its translators, resolvers or augmenters to a builder, so using it means installing the package and naming the plugin. Plugins in the extension points covers how to register one, and how to write one.

Plugins work in hybrid and spec mode. Registering one needs swagger-php 7.3 or later, and Builder::withDiscoveredPlugins() or --discover-plugins, which picks up a plugin the package declares for discovery, needs 7.6 or later.

PluginPackageWhat it doesSettingsDiscovered
Radebatz\OpenApi\Introspector\RoutesPluginopenapi-introspector 1.5Adds the routes a Laravel or Slim application already has as operationsAn adapter class mapped to that adapter's settings, or adapters passed to the constructorno
Radebatz\OpenApi\Introspector\LaravelDataPluginopenapi-introspector 1.5Describes spatie/laravel-data objects, and the data objects an operation takes and returnsnoneyes
Radebatz\OpenApi\JsonSchema\JsonSchemaPluginopenapi-json-schema 0.2Describes plain classes through symfony/json-schemadirection, groups, qualifyAttributedClasses, all optionalno
Radebatz\OpenApi\Verifier\Integrations\OpenApi\RecordedExamplesPluginopenapi-verifier 3.2Adds the responses recorded in tests as examplesdirectory, requiredno

The package version is the first release with the plugin. Each package's own documentation describes its settings.

A plugin that is not discovered is named in withPlugins(), with its settings:

php
$builder->withPlugins([
    JsonSchemaPlugin::class => ['groups' => ['read']],
    RecordedExamplesPlugin::class => ['directory' => 'tests/examples'],
]);

Is a plugin missing? Create a pull request!