ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
Public Member Functions | |
__construct ($container=[]) | |
Create new application. More... | |
getContainer () | |
Enable access to the DI container by consumers of $app. More... | |
add ($callable) | |
Add middleware. More... | |
__call ($method, $args) | |
Calling a non-existant method on App checks to see if there's an item in the container that is callable and if so, calls it. More... | |
get ($pattern, $callable) | |
Add GET route. More... | |
post ($pattern, $callable) | |
Add POST route. More... | |
put ($pattern, $callable) | |
Add PUT route. More... | |
patch ($pattern, $callable) | |
Add PATCH route. More... | |
delete ($pattern, $callable) | |
Add DELETE route. More... | |
options ($pattern, $callable) | |
Add OPTIONS route. More... | |
any ($pattern, $callable) | |
Add route for any HTTP method. More... | |
map (array $methods, $pattern, $callable) | |
Add route with multiple methods. More... | |
redirect ($from, $to, $status=302) | |
Add a route that sends an HTTP redirect. More... | |
run ($silent=false) | |
Run application. More... | |
process (ServerRequestInterface $request, ResponseInterface $response) | |
Process a request. More... | |
respond (ResponseInterface $response) | |
Send the response to the client. More... | |
subRequest ( $method, $path, $query='', array $headers=[], array $cookies=[], $bodyContent='', ResponseInterface $response=null) | |
Perform a sub-request from within an application route. More... | |
Data Fields | |
const | VERSION = '3.11.0' |
Protected Member Functions | |
processInvalidMethod (ServerRequestInterface $request, ResponseInterface $response) | |
Pull route info for a request with a bad method to decide whether to return a not-found error (default) or a bad-method error, then run the handler for that error, returning the resulting response. More... | |
dispatchRouterAndPrepareRoute (ServerRequestInterface $request, RouterInterface $router) | |
Dispatch the router to find the route. More... | |
finalize (ResponseInterface $response) | |
Finalize response. More... | |
isEmptyResponse (ResponseInterface $response) | |
Helper method, which returns true if the provided response must not output a body and false if the response could have a body. More... | |
handleException (Exception $e, ServerRequestInterface $request, ResponseInterface $response) | |
Call relevant handler from the Container if needed. More... | |
handlePhpError (Throwable $e, ServerRequestInterface $request, ResponseInterface $response) | |
Call relevant handler from the Container if needed. More... | |
Private Attributes | |
$container | |
Slim\App::__construct | ( | $container = [] | ) |
Create new application.
ContainerInterface | array | $container | Either a ContainerInterface or an associative array of app settings |
InvalidArgumentException | when no container is provided that implements ContainerInterface |
Definition at line 74 of file App.php.
References $container.
Slim\App::__call | ( | $method, | |
$args | |||
) |
Calling a non-existant method on App checks to see if there's an item in the container that is callable and if so, calls it.
string | $method | |
array | $args |
Slim\App::add | ( | $callable | ) |
Add middleware.
This method prepends new middleware to the app's middleware stack.
callable | string | $callable | The callback routine |
Definition at line 104 of file App.php.
References Slim\addMiddleware().
Slim\App::any | ( | $pattern, | |
$callable | |||
) |
Add route for any HTTP method.
string | $pattern | The route URI pattern |
callable | string | $callable | The route callback routine |
Definition at line 219 of file App.php.
Slim\App::delete | ( | $pattern, | |
$callable | |||
) |
Add DELETE route.
string | $pattern | The route URI pattern |
callable | string | $callable | The route callback routine |
Definition at line 193 of file App.php.
|
protected |
Dispatch the router to find the route.
Prepare the route for use.
ServerRequestInterface | $request | |
RouterInterface | $router |
Definition at line 583 of file App.php.
References Slim\Interfaces\RouterInterface\dispatch(), Psr\Http\Message\RequestInterface\getMethod(), Psr\Http\Message\RequestInterface\getUri(), Slim\Interfaces\RouterInterface\lookupRoute(), and Psr\Http\Message\ServerRequestInterface\withAttribute().
|
protected |
Finalize response.
ResponseInterface | $response |
Definition at line 611 of file App.php.
References $response, $size, Psr\Http\Message\MessageInterface\getBody(), Psr\Http\Message\MessageInterface\hasHeader(), Psr\Http\Message\MessageInterface\withHeader(), and Psr\Http\Message\MessageInterface\withoutHeader().
Slim\App::get | ( | $pattern, | |
$callable | |||
) |
Add GET route.
string | $pattern | The route URI pattern |
callable | string | $callable | The route callback routine |
Definition at line 141 of file App.php.
Slim\App::getContainer | ( | ) |
Enable access to the DI container by consumers of $app.
Definition at line 90 of file App.php.
References $container.
|
protected |
Call relevant handler from the Container if needed.
If it doesn't exist, then just re-throw.
Exception | $e | |
ServerRequestInterface | $request | |
ResponseInterface | $response |
Exception | if a handler is needed and not found |
Definition at line 665 of file App.php.
References $handler, PHPMailer\PHPMailer\$params, $request, and $response.
|
protected |
Call relevant handler from the Container if needed.
If it doesn't exist, then just re-throw.
Throwable | $e | |
ServerRequestInterface | $request | |
ResponseInterface | $response |
Throwable |
Definition at line 702 of file App.php.
References $handler, PHPMailer\PHPMailer\$params, $request, and $response.
|
protected |
Helper method, which returns true if the provided response must not output a body and false if the response could have a body.
ResponseInterface | $response |
Definition at line 645 of file App.php.
References Psr\Http\Message\ResponseInterface\getStatusCode().
Slim\App::map | ( | array | $methods, |
$pattern, | |||
$callable | |||
) |
Slim\App::options | ( | $pattern, | |
$callable | |||
) |
Add OPTIONS route.
string | $pattern | The route URI pattern |
callable | string | $callable | The route callback routine |
Definition at line 206 of file App.php.
Slim\App::patch | ( | $pattern, | |
$callable | |||
) |
Add PATCH route.
string | $pattern | The route URI pattern |
callable | string | $callable | The route callback routine |
Definition at line 180 of file App.php.
Slim\App::post | ( | $pattern, | |
$callable | |||
) |
Add POST route.
string | $pattern | The route URI pattern |
callable | string | $callable | The route callback routine |
Definition at line 154 of file App.php.
Referenced by ilRestServer\init().
Slim\App::process | ( | ServerRequestInterface | $request, |
ResponseInterface | $response | ||
) |
Process a request.
This method traverses the application middleware stack and then returns the resultant Response object.
ServerRequestInterface | $request | |
ResponseInterface | $response |
Exception | |
MethodNotAllowedException | |
NotFoundException |
Definition at line 390 of file App.php.
References $response, and Psr\Http\Message\RequestInterface\getUri().
|
protected |
Pull route info for a request with a bad method to decide whether to return a not-found error (default) or a bad-method error, then run the handler for that error, returning the resulting response.
Used for cases where an incoming request has an unrecognized method, rather than throwing an exception and not catching it all the way up.
ServerRequestInterface | $request | |
ResponseInterface | $response |
Definition at line 355 of file App.php.
References Psr\Http\Message\ServerRequestInterface\getAttribute(), and Psr\Http\Message\RequestInterface\getUri().
Slim\App::put | ( | $pattern, | |
$callable | |||
) |
Add PUT route.
string | $pattern | The route URI pattern |
callable | string | $callable | The route callback routine |
Definition at line 167 of file App.php.
Slim\App::redirect | ( | $from, | |
$to, | |||
$status = 302 |
|||
) |
Slim\App::respond | ( | ResponseInterface | $response | ) |
Send the response to the client.
ResponseInterface | $response |
Definition at line 421 of file App.php.
References $contentLength, $data, $name, $request, $response, $values, Psr\Http\Message\ServerRequestInterface\getAttribute(), Psr\Http\Message\MessageInterface\getBody(), Psr\Http\Message\MessageInterface\getHeaderLine(), Psr\Http\Message\MessageInterface\getHeaders(), Psr\Http\Message\RequestInterface\getMethod(), Psr\Http\Message\MessageInterface\getProtocolVersion(), Psr\Http\Message\ResponseInterface\getReasonPhrase(), Psr\Http\Message\ResponseInterface\getStatusCode(), and Psr\Http\Message\RequestInterface\getUri().
Slim\App::run | ( | $silent = false | ) |
Run application.
This method traverses the application middleware stack and then sends the resultant Response object to the HTTP client.
bool | false | $silent |
Exception | |
MethodNotAllowedException | |
NotFoundException |
Definition at line 308 of file App.php.
References Sabre\VObject\$output, $response, and Slim\Exception\InvalidMethodException\getRequest().
Slim\App::subRequest | ( | $method, | |
$path, | |||
$query = '' , |
|||
array | $headers = [] , |
||
array | $cookies = [] , |
||
$bodyContent = '' , |
|||
ResponseInterface | $response = null |
||
) |
Perform a sub-request from within an application route.
This method allows you to prepare and initiate a sub-request, run within the context of the current request. This WILL NOT issue a remote HTTP request. Instead, it will route the provided URL, method, headers, cookies, body, and server variables against the set of registered application routes. The result response object is returned.
string | $method | The request method (e.g., GET, POST, PUT, etc.) |
string | $path | The request URI path |
string | $query | The request URI query string |
array | $headers | The request headers (key-value array) |
array | $cookies | The request cookies (key-value array) |
string | $bodyContent | The request body |
ResponseInterface | $response | The response object (optional) |
Definition at line 551 of file App.php.
References $env, $path, and $query.
|
private |
Definition at line 62 of file App.php.
Referenced by ilRestServer\__construct().