PHP Класс Psr7Middlewares\Middleware\Cors

Показать файл Открыть проект

Открытые методы

Метод Описание
__construct ( Neomerx\Cors\Contracts\Strategies\SettingsStrategyInterface $settings = null ) Defines the settings used.
__invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface Execute the middleware.
allowCredentials ( boolean $allow = true ) : self If access with credentials is supported by the resource.
allowedHeaders ( array $headers, boolean $force = false ) : self Set allowed headers.
allowedMethods ( array $methods, boolean $force = false ) : self Set allowed methods.
allowedOrigins ( array $origins ) : self Set allowed origins.
checkHost ( boolean $checkHost = true ) : self If request 'Host' header should be checked against server's origin.
exposedHeaders ( array $headers ) : self Set headers other than the simple ones that might be exposed to user agent.
maxAge ( integer $maxAge ) : self Set pre-flight cache max period in seconds.
origin ( string | array $origin ) : self Set the server origin.

Описание методов

__construct() публичный Метод

Defines the settings used.
public __construct ( Neomerx\Cors\Contracts\Strategies\SettingsStrategyInterface $settings = null )
$settings Neomerx\Cors\Contracts\Strategies\SettingsStrategyInterface

__invoke() публичный Метод

Execute the middleware.
public __invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface
$request Psr\Http\Message\ServerRequestInterface
$response Psr\Http\Message\ResponseInterface
$next callable
Результат Psr\Http\Message\ResponseInterface

allowCredentials() публичный Метод

If access with credentials is supported by the resource.
См. также: Neomerx\Cors\Contracts\Strategies::setRequestCredentialsSupported
public allowCredentials ( boolean $allow = true ) : self
$allow boolean
Результат self

allowedHeaders() публичный Метод

Set allowed headers.
См. также: Neomerx\Cors\Contracts\Strategies::setRequestAllowedHeaders
См. также: Neomerx\Cors\Contracts\Strategies::setForceAddAllowedHeadersToPreFlightResponse
public allowedHeaders ( array $headers, boolean $force = false ) : self
$headers array
$force boolean If allowed headers should be added to pre-flight response
Результат self

allowedMethods() публичный Метод

Set allowed methods.
См. также: Neomerx\Cors\Contracts\Strategies::setRequestAllowedMethods
См. также: Neomerx\Cors\Contracts\Strategies::setForceAddAllowedMethodsToPreFlightResponse
public allowedMethods ( array $methods, boolean $force = false ) : self
$methods array
$force boolean If allowed methods should be added to pre-flight response
Результат self

allowedOrigins() публичный Метод

Set allowed origins.
См. также: Neomerx\Cors\Contracts\Strategies::setRequestAllowedOrigins
public allowedOrigins ( array $origins ) : self
$origins array
Результат self

checkHost() публичный Метод

If request 'Host' header should be checked against server's origin.
См. также: Neomerx\Cors\Contracts\Strategies::setCheckHost
public checkHost ( boolean $checkHost = true ) : self
$checkHost boolean
Результат self

exposedHeaders() публичный Метод

Set headers other than the simple ones that might be exposed to user agent.
См. также: Neomerx\Cors\Contracts\Strategies::setResponseExposedHeaders
public exposedHeaders ( array $headers ) : self
$headers array
Результат self

maxAge() публичный Метод

Set pre-flight cache max period in seconds.
См. также: Neomerx\Cors\Contracts\Strategies::setPreFlightCacheMaxAge
public maxAge ( integer $maxAge ) : self
$maxAge integer
Результат self

origin() публичный Метод

Set the server origin.
См. также: Neomerx\Cors\Contracts\Strategies::setServerOrigin
public origin ( string | array $origin ) : self
$origin string | array
Результат self