# Middlewares
Middlewares are an optional bit of logic to transform the given data at various lifecycle points.
# Path
To add a path middleware create a class that implements \Vyuldashev\LaravelOpenApi\Contracts\PathMiddleware
then register it by referencing it in the openapi.collections.default.middlewares.paths
config array like MyPathMiddleware::class
Available lifecycle points are:
before
- after collecting allRouteInformation
but before processing them.after
- after thePathItem
has been built.
# Component
To add a path middleware create a class that implements \Vyuldashev\LaravelOpenApi\Contracts\ComponentMiddleware
then register it by referencing it in the openapi.collections.default.middlewares.components
config array like MyComponentMiddleware::class
Available lifecycle points are:
after
- after theComponents
has been built.
← Collections Security →