PHP Trait Laravel\Lumen\Concerns\RoutesRequests

Mostra file Open project: laravel/lumen-framework

Public Properties

Property Type Description
$namedRoutes array All of the named routes and URI pairs.

Protected Properties

Property Type Description
$currentRoute array The current route being dispatched.
$dispatcher FastRoute\Dispatcher The FastRoute dispatcher.
$groupAttributes array | null The shared attributes for the current route group.
$middleware array All of the global middleware for the application.
$routeMiddleware array All of the route specific middleware short-hands.
$routes array All of the routes waiting to be registered.

Public Methods

Method Description
addRoute ( array | string $method, string $uri, mixed $action ) : void Add a route to the collection.
delete ( string $uri, mixed $action ) Register a route with the application.
dispatch ( Request | null $request = null ) : Illuminate\Http\Response Dispatch the incoming request.
get ( string $uri, mixed $action ) Register a route with the application.
getRoutes ( ) : array Get the raw routes for the application.
group ( array $attributes, Closure $callback ) : void Register a set of routes with a set of shared attributes.
handle ( Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true )
middleware ( Closur\Closure | array $middleware ) Add new middleware to the application.
options ( string $uri, mixed $action ) Register a route with the application.
patch ( string $uri, mixed $action ) Register a route with the application.
post ( string $uri, mixed $action ) Register a route with the application.
prepareResponse ( mixed $response ) : Illuminate\Http\Response Prepare the response for sending.
put ( string $uri, mixed $action ) Register a route with the application.
routeMiddleware ( array $middleware ) Define the route middleware for the application.
run ( Request | null $request = null ) : void Run the application and send the response.
setDispatcher ( FastRoute\Dispatcher $dispatcher ) : void Set the FastRoute dispatcher instance.

Protected Methods

Method Description
callActionOnArrayBasedRoute ( array $routeInfo ) : mixed Call the Closure on the array based route.
callControllerAction ( array $routeInfo ) : mixed Call a controller based route.
callControllerCallable ( callable $callable, array $parameters = [] ) : Illuminate\Http\Response Call a controller callable and return the response.
callLumenController ( mixed $instance, string $method, array $routeInfo ) : mixed Send the request through a Lumen controller.
callLumenControllerWithMiddleware ( mixed $instance, string $method, array $routeInfo, array $middleware ) : mixed Send the request through a set of controller middleware.
callTerminableMiddleware ( mixed $response ) : void Call the terminable middleware.
createDispatcher ( ) : FastRoute\Dispatcher Create a FastRoute dispatcher instance for the application.
gatherMiddlewareClassNames ( string $middleware ) : array Gather the full class names for the middleware short-cut string.
getMethod ( ) : string Get the current HTTP request method.
getPathInfo ( ) : string Get the current HTTP path info.
handleDispatcherResponse ( array $routeInfo ) : mixed Handle the response from the FastRoute dispatcher.
handleFoundRoute ( array $routeInfo ) : mixed Handle a route found by the dispatcher.
mergeGroupAttributes ( array $action ) : array Merge the group attributes into the action.
mergeMiddlewareGroup ( array $action ) : array Merge the middleware group into the action.
mergeNamespaceGroup ( array $action ) : array Merge the namespace group into the action.
parseAction ( mixed $action ) : array Parse the action into an array format.
parseIncomingRequest ( Illuminate\Http\Request | null $request ) : array Parse the incoming request and return the method and path info.
sendThroughPipeline ( array $middleware, Closure $then ) : mixed Send the request through the pipeline with the given callback.
shouldSkipMiddleware ( ) : boolean Determines whether middleware should be skipped during request.

Method Details

addRoute() public method

Add a route to the collection.
public addRoute ( array | string $method, string $uri, mixed $action ) : void
$method array | string
$uri string
$action mixed
return void

callActionOnArrayBasedRoute() protected method

Call the Closure on the array based route.
protected callActionOnArrayBasedRoute ( array $routeInfo ) : mixed
$routeInfo array
return mixed

callControllerAction() protected method

Call a controller based route.
protected callControllerAction ( array $routeInfo ) : mixed
$routeInfo array
return mixed

callControllerCallable() protected method

Call a controller callable and return the response.
protected callControllerCallable ( callable $callable, array $parameters = [] ) : Illuminate\Http\Response
$callable callable
$parameters array
return Illuminate\Http\Response

callLumenController() protected method

Send the request through a Lumen controller.
protected callLumenController ( mixed $instance, string $method, array $routeInfo ) : mixed
$instance mixed
$method string
$routeInfo array
return mixed

callLumenControllerWithMiddleware() protected method

Send the request through a set of controller middleware.
protected callLumenControllerWithMiddleware ( mixed $instance, string $method, array $routeInfo, array $middleware ) : mixed
$instance mixed
$method string
$routeInfo array
$middleware array
return mixed

callTerminableMiddleware() protected method

Call the terminable middleware.
protected callTerminableMiddleware ( mixed $response ) : void
$response mixed
return void

createDispatcher() protected method

Create a FastRoute dispatcher instance for the application.
protected createDispatcher ( ) : FastRoute\Dispatcher
return FastRoute\Dispatcher

delete() public method

Register a route with the application.
public delete ( string $uri, mixed $action )
$uri string
$action mixed

dispatch() public method

Dispatch the incoming request.
public dispatch ( Request | null $request = null ) : Illuminate\Http\Response
$request Symfony\Component\HttpFoundation\Request | null
return Illuminate\Http\Response

gatherMiddlewareClassNames() protected method

Gather the full class names for the middleware short-cut string.
protected gatherMiddlewareClassNames ( string $middleware ) : array
$middleware string
return array

get() public method

Register a route with the application.
public get ( string $uri, mixed $action )
$uri string
$action mixed

getMethod() protected method

Get the current HTTP request method.
protected getMethod ( ) : string
return string

getPathInfo() protected method

Get the current HTTP path info.
protected getPathInfo ( ) : string
return string

getRoutes() public method

Get the raw routes for the application.
public getRoutes ( ) : array
return array

group() public method

Register a set of routes with a set of shared attributes.
public group ( array $attributes, Closure $callback ) : void
$attributes array
$callback Closure
return void

handle() public method

public handle ( Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true )
$request Symfony\Component\HttpFoundation\Request

handleDispatcherResponse() protected method

Handle the response from the FastRoute dispatcher.
protected handleDispatcherResponse ( array $routeInfo ) : mixed
$routeInfo array
return mixed

handleFoundRoute() protected method

Handle a route found by the dispatcher.
protected handleFoundRoute ( array $routeInfo ) : mixed
$routeInfo array
return mixed

mergeGroupAttributes() protected method

Merge the group attributes into the action.
protected mergeGroupAttributes ( array $action ) : array
$action array
return array

mergeMiddlewareGroup() protected method

Merge the middleware group into the action.
protected mergeMiddlewareGroup ( array $action ) : array
$action array
return array

mergeNamespaceGroup() protected method

Merge the namespace group into the action.
protected mergeNamespaceGroup ( array $action ) : array
$action array
return array

middleware() public method

Add new middleware to the application.
public middleware ( Closur\Closure | array $middleware )
$middleware Closur\Closure | array

options() public method

Register a route with the application.
public options ( string $uri, mixed $action )
$uri string
$action mixed

parseAction() protected method

Parse the action into an array format.
protected parseAction ( mixed $action ) : array
$action mixed
return array

parseIncomingRequest() protected method

Parse the incoming request and return the method and path info.
protected parseIncomingRequest ( Illuminate\Http\Request | null $request ) : array
$request Illuminate\Http\Request | null
return array

patch() public method

Register a route with the application.
public patch ( string $uri, mixed $action )
$uri string
$action mixed

post() public method

Register a route with the application.
public post ( string $uri, mixed $action )
$uri string
$action mixed

prepareResponse() public method

Prepare the response for sending.
public prepareResponse ( mixed $response ) : Illuminate\Http\Response
$response mixed
return Illuminate\Http\Response

put() public method

Register a route with the application.
public put ( string $uri, mixed $action )
$uri string
$action mixed

routeMiddleware() public method

Define the route middleware for the application.
public routeMiddleware ( array $middleware )
$middleware array

run() public method

Run the application and send the response.
public run ( Request | null $request = null ) : void
$request Symfony\Component\HttpFoundation\Request | null
return void

sendThroughPipeline() protected method

Send the request through the pipeline with the given callback.
protected sendThroughPipeline ( array $middleware, Closure $then ) : mixed
$middleware array
$then Closure
return mixed

setDispatcher() public method

Set the FastRoute dispatcher instance.
public setDispatcher ( FastRoute\Dispatcher $dispatcher ) : void
$dispatcher FastRoute\Dispatcher
return void

shouldSkipMiddleware() protected method

Determines whether middleware should be skipped during request.
protected shouldSkipMiddleware ( ) : boolean
return boolean

Property Details

$currentRoute protected_oe property

The current route being dispatched.
protected array $currentRoute
return array

$dispatcher protected_oe property

The FastRoute dispatcher.
protected Dispatcher,FastRoute $dispatcher
return FastRoute\Dispatcher

$groupAttributes protected_oe property

The shared attributes for the current route group.
protected array|null $groupAttributes
return array | null

$middleware protected_oe property

All of the global middleware for the application.
protected array $middleware
return array

$namedRoutes public_oe property

All of the named routes and URI pairs.
public array $namedRoutes
return array

$routeMiddleware protected_oe property

All of the route specific middleware short-hands.
protected array $routeMiddleware
return array

$routes protected_oe property

All of the routes waiting to be registered.
protected array $routes
return array