Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250620) (7d9030acd6e)
core\router Class Reference

Public Member Functions

 __construct (protected response_handler response_handler $responsehandler, protected route_loader_interface readonly route_loader_interface $routeloader, protected request_validator_interface request_validator_interface $requestvalidator, protected response_validator_interface response_validator_interface $responsevalidator, ?string $basepath=null,)
 Create a new Router.
 
 get_app ()
 Get the configured SlimPHP Application.
 
 get_response_factory ()
 Get the Response Factory for the Router.
 
 handle_request (ServerRequestInterface $request,)
 Handle the specified Request.
 
 serve ()
 Serve the current request using global variables.
 

Public Attributes

string readonly string $basepath
 The base path to use for all requests.
 

Protected Member Functions

 add_error_handler_middleware ()
 Add the Error Handling Middleware to the RouteGroup.
 
 add_middleware ()
 Add Middleware to the App.
 
 configure_api_route (RouteGroupInterface $group)
 Configure the API Route Middleware.
 
 configure_caching ()
 Configure caching for the routes.
 
 configure_routes ()
 Configure the API routes.
 
 configure_shim_route (RouteGroupInterface $group)
 Configure the Shim Route Middleware.
 
 configure_standard_route (RouteGroupInterface $group)
 Configure the Standard page Route Middleware.
 
 create_app (string $basepath='',)
 Create the configured SlimPHP Application.
 
 guess_basepath ()
 Guess the basepath for the Router.
 

Protected Attributes

App readonly App $app
 The SlimPHP App.
 

Constructor & Destructor Documentation

◆ __construct()

core\router::__construct ( protected response_handler response_handler $responsehandler,
protected route_loader_interface readonly route_loader_interface $routeloader,
protected request_validator_interface request_validator_interface $requestvalidator,
protected response_validator_interface response_validator_interface $responsevalidator,
?string $basepath = null )

Create a new Router.

Parameters
response_handler$responsehandler
route_loader_interface$routeloader
request_validator_interface$requestvalidator
response_validator_interface$responsevalidator
null | string$basepath
Parameters
$routeloaderThe router loader to use

Member Function Documentation

◆ configure_api_route()

core\router::configure_api_route ( RouteGroupInterface $group)
protected

Configure the API Route Middleware.

Parameters
RouteGroupInterface$group

◆ configure_shim_route()

core\router::configure_shim_route ( RouteGroupInterface $group)
protected

Configure the Shim Route Middleware.

Parameters
RouteGroupInterface$group

◆ configure_standard_route()

core\router::configure_standard_route ( RouteGroupInterface $group)
protected

Configure the Standard page Route Middleware.

Parameters
RouteGroupInterface$group

◆ create_app()

core\router::create_app ( string $basepath = '')
protected

Create the configured SlimPHP Application.

Parameters
string$basepathThe base path of the Moodle instance

◆ get_app()

core\router::get_app ( )

Get the configured SlimPHP Application.

Return values
App

◆ get_response_factory()

core\router::get_response_factory ( )

Get the Response Factory for the Router.

Return values
ResponseFactoryInterface

◆ guess_basepath()

core\router::guess_basepath ( )
protected

Guess the basepath for the Router.

Return values
string

◆ handle_request()

core\router::handle_request ( ServerRequestInterface $request)

Handle the specified Request.

Parameters
ServerRequestInterface$request
Return values
ResponseInterface

◆ serve()

core\router::serve ( )

Serve the current request using global variables.

@codeCoverageIgnore


The documentation for this class was generated from the following file: