Moodle PHP Documentation 4.5
Moodle 4.5.5+ (Build: 20250711) (ce34e8ff087)
|
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.
| ||||||||||
delete (string $pattern, $callable) | ||||||||||
{Add DELETE route.
| ||||||||||
get (string $pattern, $callable) | ||||||||||
{Add GET route.
| ||||||||||
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.
| ||||||||||
handle (ServerRequestInterface $request) | ||||||||||
Handle a request. | ||||||||||
map (array $methods, string $pattern, $callable) | ||||||||||
{Add route with multiple methods.
| ||||||||||
options (string $pattern, $callable) | ||||||||||
{Add OPTIONS route.
| ||||||||||
patch (string $pattern, $callable) | ||||||||||
{Add PATCH route.
| ||||||||||
post (string $pattern, $callable) | ||||||||||
{Add POST route.
| ||||||||||
put (string $pattern, $callable) | ||||||||||
{Add PUT route.
| ||||||||||
redirect (string $from, $to, int $status=302) | ||||||||||
{Add a route that sends an HTTP redirect.
| ||||||||||
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 |
Slim\App::add | ( | $middleware | ) |
MiddlewareInterface | string | callable | $middleware |
Slim\App::addBodyParsingMiddleware | ( | array | $bodyParsers = [] | ) |
Add the Slim body parsing middleware to the app middleware stack.
callable[] | $bodyParsers |
BodyParsingMiddleware |
Slim\App::addErrorMiddleware | ( | bool | $displayErrorDetails, |
bool | $logErrors, | ||
bool | $logErrorDetails, | ||
?LoggerInterface | $logger = null ) |
Add the Slim built-in error middleware to the app middleware stack.
bool | $displayErrorDetails | |
bool | $logErrors | |
bool | $logErrorDetails | |
LoggerInterface | null | $logger |
ErrorMiddleware |
Slim\App::addMiddleware | ( | MiddlewareInterface | $middleware | ) |
MiddlewareInterface | $middleware |
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.
RoutingMiddleware |
|
inherited |
{Add route for any HTTP method.
string | $pattern | The route URI pattern |
callable | string | $callable | The route callback routine |
Implements Slim\Interfaces\RouteCollectorProxyInterface.
|
inherited |
{Add DELETE route.
string | $pattern | The route URI pattern |
callable | string | $callable | The route callback routine |
Implements Slim\Interfaces\RouteCollectorProxyInterface.
|
inherited |
{Add GET route.
string | $pattern | The route URI pattern |
callable | string | $callable | The route callback routine |
Implements Slim\Interfaces\RouteCollectorProxyInterface.
|
inherited |
{Get the RouteCollectorProxy's base path.}
Implements Slim\Interfaces\RouteCollectorProxyInterface.
|
inherited |
{}
Implements Slim\Interfaces\RouteCollectorProxyInterface.
|
inherited |
{}
Implements Slim\Interfaces\RouteCollectorProxyInterface.
Slim\App::getMiddlewareDispatcher | ( | ) |
MiddlewareDispatcherInterface |
|
inherited |
{}
Implements Slim\Interfaces\RouteCollectorProxyInterface.
|
inherited |
{}
Implements Slim\Interfaces\RouteCollectorProxyInterface.
Slim\App::getRouteResolver | ( | ) |
RouteResolverInterface |
|
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.
string | callable | $callable |
Implements Slim\Interfaces\RouteCollectorProxyInterface.
Slim\App::handle | ( | ServerRequestInterface | $request | ) |
Handle a request.
This method traverses the application middleware stack and then returns the resultant Response object.
ServerRequestInterface | $request |
ResponseInterface |
Implements Psr\Http\Server\RequestHandlerInterface.
|
inherited |
{Add route with multiple methods.
string[] | $methods | Numeric array of HTTP method names |
string | $pattern | The route URI pattern |
callable | string | $callable | The route callback routine |
Implements Slim\Interfaces\RouteCollectorProxyInterface.
|
inherited |
{Add OPTIONS route.
string | $pattern | The route URI pattern |
callable | string | $callable | The route callback routine |
Implements Slim\Interfaces\RouteCollectorProxyInterface.
|
inherited |
{Add PATCH route.
string | $pattern | The route URI pattern |
callable | string | $callable | The route callback routine |
Implements Slim\Interfaces\RouteCollectorProxyInterface.
|
inherited |
{Add POST route.
string | $pattern | The route URI pattern |
callable | string | $callable | The route callback routine |
Implements Slim\Interfaces\RouteCollectorProxyInterface.
|
inherited |
{Add PUT route.
string | $pattern | The route URI pattern |
callable | string | $callable | The route callback routine |
Implements Slim\Interfaces\RouteCollectorProxyInterface.
|
inherited |
{Add a route that sends an HTTP redirect.
string | UriInterface | $to |
Implements Slim\Interfaces\RouteCollectorProxyInterface.
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.
ServerRequestInterface | null | $request |
void |
|
inherited |
{Set the RouteCollectorProxy's base path.}
Implements Slim\Interfaces\RouteCollectorProxyInterface.