Skip to content

CorsPlugin

Registers CorsMiddleware through the generic plugin seam, opt-in via cors.enabled (the middleware itself no-ops when it’s false, so simply installing this package doesn’t turn CORS on for every app).

final class CorsPlugin implements PluginInterface

ImplementsPluginInterface
SourceCorsPlugin.php
MethodDescription
register(PluginRegistrar $registrar): voidRegisters the CORS configuration defaults and the middleware itself.

public function register(PluginRegistrar $registrar): void

Registers the CORS configuration defaults and the middleware itself.

cors.enabled defaults to false, so installing the package alone does not switch CORS on. The middleware is registered through its #[Middleware] attribute, which places it in the pipeline.

ParameterTypeDescription
$registrarPluginRegistrar