Moodle PHP Documentation 5.0
Moodle 5.0.1+ (Build: 20250711) (61af040cd5f)
Slim\App Class Reference
Inheritance diagram for Slim\App:
Slim\Routing\RouteCollectorProxy Psr\Http\Server\RequestHandlerInterface Slim\Interfaces\RouteCollectorProxyInterface

Public Member Functions

 __construct (ResponseFactoryInterface $responseFactory, ?ContainerInterface $container=null, ?CallableResolverInterface $callableResolver=null, ?RouteCollectorInterface $routeCollector=null, ?RouteResolverInterface $routeResolver=null, ?MiddlewareDispatcherInterface $middlewareDispatcher=null)
 
 add ($middleware)
 
 addBodyParsingMiddleware (array $bodyParsers=[])
 Add the Slim body parsing middleware to the app middleware stack.
 
 addErrorMiddleware (bool $displayErrorDetails, bool $logErrors, bool $logErrorDetails, ?LoggerInterface $logger=null)
 Add the Slim built-in error middleware to the app middleware stack.
 
 addMiddleware (MiddlewareInterface $middleware)
 
 addRoutingMiddleware ()
 Add the Slim built-in routing middleware to the app middleware stack.
 
 any (string $pattern, $callable)
 {Add route for any HTTP method.
Parameters
string$patternThe route URI pattern
callable | string$callableThe route callback routine
}
 
 delete (string $pattern, $callable)
 {Add DELETE route.
Parameters
string$patternThe route URI pattern
callable | string$callableThe route callback routine
}
 
 get (string $pattern, $callable)
 {Add GET route.
Parameters
string$patternThe route URI pattern
callable | string$callableThe route callback routine
}
 
 getBasePath ()
 {Get the RouteCollectorProxy's base path.}
 
 getCallableResolver ()
 {}
 
 getContainer ()
 {}
 
 getMiddlewareDispatcher ()
 
 getResponseFactory ()
 {}
 
 getRouteCollector ()
 {}
 
 getRouteResolver ()
 
 group (string $pattern, $callable)
 {Route Groups.This method accepts a route pattern and a callback. All route declarations in the callback will be prepended by the group(s) that it is in.

Parameters
string | callable$callable
}
 
 handle (ServerRequestInterface $request)
 Handle a request.
 
 map (array $methods, string $pattern, $callable)
 {Add route with multiple methods.
Parameters
string[]$methodsNumeric array of HTTP method names
string$patternThe route URI pattern
callable | string$callableThe route callback routine
}
 
 options (string $pattern, $callable)
 {Add OPTIONS route.
Parameters
string$patternThe route URI pattern
callable | string$callableThe route callback routine
}
 
 patch (string $pattern, $callable)
 {Add PATCH route.
Parameters
string$patternThe route URI pattern
callable | string$callableThe route callback routine
}
 
 post (string $pattern, $callable)
 {Add POST route.
Parameters
string$patternThe route URI pattern
callable | string$callableThe route callback routine
}
 
 put (string $pattern, $callable)
 {Add PUT route.
Parameters
string$patternThe route URI pattern
callable | string$callableThe route callback routine
}
 
 redirect (string $from, $to, int $status=302)
 {Add a route that sends an HTTP redirect.
Parameters
string | UriInterface$to
}
 
 run (?ServerRequestInterface $request=null)
 Run application.
 
 setBasePath (string $basePath)
 {Set the RouteCollectorProxy's base path.}
 

Public Attributes

string const VERSION = '4.12.0'
 Current version.
 

Protected Attributes

CallableResolverInterface $callableResolver
 
ContainerInterface $container = null
 
string $groupPattern
 
MiddlewareDispatcherInterface $middlewareDispatcher
 
ResponseFactoryInterface $responseFactory
 
RouteCollectorInterface $routeCollector
 
RouteResolverInterface $routeResolver
 

Member Function Documentation

◆ add()

Slim\App::add ( $middleware)
Parameters
MiddlewareInterface | string | callable$middleware

◆ addBodyParsingMiddleware()

Slim\App::addBodyParsingMiddleware ( array $bodyParsers = [])

Add the Slim body parsing middleware to the app middleware stack.

Parameters
callable[]$bodyParsers
Return values
BodyParsingMiddleware

◆ addErrorMiddleware()

Slim\App::addErrorMiddleware ( bool $displayErrorDetails,
bool $logErrors,
bool $logErrorDetails,
?LoggerInterface $logger = null )

Add the Slim built-in error middleware to the app middleware stack.

Parameters
bool$displayErrorDetails
bool$logErrors
bool$logErrorDetails
LoggerInterface | null$logger
Return values
ErrorMiddleware

◆ addMiddleware()

Slim\App::addMiddleware ( MiddlewareInterface $middleware)
Parameters
MiddlewareInterface$middleware

◆ addRoutingMiddleware()

Slim\App::addRoutingMiddleware ( )

Add the Slim built-in routing middleware to the app middleware stack.

This method can be used to control middleware order and is not required for default routing operation.

Return values
RoutingMiddleware

◆ any()

Slim\Routing\RouteCollectorProxy::any ( string $pattern,
$callable )
inherited

{Add route for any HTTP method.

Parameters
string$patternThe route URI pattern
callable | string$callableThe route callback routine
}

Implements Slim\Interfaces\RouteCollectorProxyInterface.

◆ delete()

Slim\Routing\RouteCollectorProxy::delete ( string $pattern,
$callable )
inherited

{Add DELETE route.

Parameters
string$patternThe route URI pattern
callable | string$callableThe route callback routine
}

Implements Slim\Interfaces\RouteCollectorProxyInterface.

◆ get()

Slim\Routing\RouteCollectorProxy::get ( string $pattern,
$callable )
inherited

{Add GET route.

Parameters
string$patternThe route URI pattern
callable | string$callableThe route callback routine
}

Implements Slim\Interfaces\RouteCollectorProxyInterface.

◆ getBasePath()

Slim\Routing\RouteCollectorProxy::getBasePath ( )
inherited

◆ getCallableResolver()

Slim\Routing\RouteCollectorProxy::getCallableResolver ( )
inherited

◆ getContainer()

Slim\Routing\RouteCollectorProxy::getContainer ( )
inherited

◆ getMiddlewareDispatcher()

Slim\App::getMiddlewareDispatcher ( )
Return values
MiddlewareDispatcherInterface

◆ getResponseFactory()

Slim\Routing\RouteCollectorProxy::getResponseFactory ( )
inherited

◆ getRouteCollector()

Slim\Routing\RouteCollectorProxy::getRouteCollector ( )
inherited

◆ getRouteResolver()

Slim\App::getRouteResolver ( )
Return values
RouteResolverInterface

◆ group()

Slim\Routing\RouteCollectorProxy::group ( string $pattern,
$callable )
inherited

{Route Groups.This method accepts a route pattern and a callback. All route declarations in the callback will be prepended by the group(s) that it is in.

Parameters
string | callable$callable
}

Implements Slim\Interfaces\RouteCollectorProxyInterface.

◆ handle()

Slim\App::handle ( ServerRequestInterface $request)

Handle a request.

This method traverses the application middleware stack and then returns the resultant Response object.

Parameters
ServerRequestInterface$request
Return values
ResponseInterface

Implements Psr\Http\Server\RequestHandlerInterface.

◆ map()

Slim\Routing\RouteCollectorProxy::map ( array $methods,
string $pattern,
$callable )
inherited

{Add route with multiple methods.

Parameters
string[]$methodsNumeric array of HTTP method names
string$patternThe route URI pattern
callable | string$callableThe route callback routine
}

Implements Slim\Interfaces\RouteCollectorProxyInterface.

◆ options()

Slim\Routing\RouteCollectorProxy::options ( string $pattern,
$callable )
inherited

{Add OPTIONS route.

Parameters
string$patternThe route URI pattern
callable | string$callableThe route callback routine
}

Implements Slim\Interfaces\RouteCollectorProxyInterface.

◆ patch()

Slim\Routing\RouteCollectorProxy::patch ( string $pattern,
$callable )
inherited

{Add PATCH route.

Parameters
string$patternThe route URI pattern
callable | string$callableThe route callback routine
}

Implements Slim\Interfaces\RouteCollectorProxyInterface.

◆ post()

Slim\Routing\RouteCollectorProxy::post ( string $pattern,
$callable )
inherited

{Add POST route.

Parameters
string$patternThe route URI pattern
callable | string$callableThe route callback routine
}

Implements Slim\Interfaces\RouteCollectorProxyInterface.

◆ put()

Slim\Routing\RouteCollectorProxy::put ( string $pattern,
$callable )
inherited

{Add PUT route.

Parameters
string$patternThe route URI pattern
callable | string$callableThe route callback routine
}

Implements Slim\Interfaces\RouteCollectorProxyInterface.

◆ redirect()

Slim\Routing\RouteCollectorProxy::redirect ( string $from,
$to,
int $status = 302 )
inherited

{Add a route that sends an HTTP redirect.

Parameters
string | UriInterface$to
}

Implements Slim\Interfaces\RouteCollectorProxyInterface.

◆ run()

Slim\App::run ( ?ServerRequestInterface $request = null)

Run application.

This method traverses the application middleware stack and then sends the resultant Response object to the HTTP client.

Parameters
ServerRequestInterface | null$request
Return values
void

◆ setBasePath()

Slim\Routing\RouteCollectorProxy::setBasePath ( string $basePath)
inherited

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