CorsMiddleware
in package
implements
MiddlewareInterface
Middleware class to add Cross-Origin Resource Sharing (CORS) headers to responses.
Tags
Interfaces, Classes, Traits and Enums
- MiddlewareInterface
Table of Contents
- addCorsHeaders() : ResponseInterface
- Add CORS headers to the response.
- process() : ResponseInterface
- Process the middleware.
Methods
addCorsHeaders()
Add CORS headers to the response.
public
addCorsHeaders(ServerRequestInterface $request, ResponseInterface $response) : ResponseInterface
Parameters
- $request : ServerRequestInterface
-
The PSR-7 request.
- $response : ResponseInterface
-
The PSR-7 response.
Return values
ResponseInterface —The PSR-7 response with added CORS headers.
process()
Process the middleware.
public
process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
- $request : ServerRequestInterface
-
The PSR-7 request.
- $handler : RequestHandlerInterface
-
The PSR-7 request handler.
Return values
ResponseInterface —The PSR-7 response.