PHP Class Dingo\Api\Http\Middleware\RateLimit

Mostra file Open project: dingo/api

Protected Properties

Property Type Description
$handler Dingo\Api\Http\RateLimit\Handler Rate limit handler instance.
$router Dingo\Api\Routing\Router Router instance.

Public Methods

Method Description
__construct ( Router $router, Handler $handler ) : void Create a new rate limit middleware instance.
handle ( Dingo\Api\Http\Request $request, Closure $next ) : mixed Perform rate limiting before a request is executed.

Protected Methods

Method Description
getHeaders ( ) : array Get the headers for the response.
responseWithHeaders ( Response $response ) : Response Send the response with the rate limit headers.

Method Details

__construct() public method

Create a new rate limit middleware instance.
public __construct ( Router $router, Handler $handler ) : void
$router Dingo\Api\Routing\Router
$handler Dingo\Api\Http\RateLimit\Handler
return void

getHeaders() protected method

Get the headers for the response.
protected getHeaders ( ) : array
return array

handle() public method

Perform rate limiting before a request is executed.
public handle ( Dingo\Api\Http\Request $request, Closure $next ) : mixed
$request Dingo\Api\Http\Request
$next Closure
return mixed

responseWithHeaders() protected method

Send the response with the rate limit headers.
protected responseWithHeaders ( Response $response ) : Response
$response Dingo\Api\Http\Response
return Dingo\Api\Http\Response

Property Details

$handler protected_oe property

Rate limit handler instance.
protected Handler,Dingo\Api\Http\RateLimit $handler
return Dingo\Api\Http\RateLimit\Handler

$router protected_oe property

Router instance.
protected Router,Dingo\Api\Routing $router
return Dingo\Api\Routing\Router