Application
in package
implements
ArrayAccess
Lumos application for a Tsugi web request.
Table of Contents
Interfaces
- ArrayAccess
Properties
- $router : Router
- The router instance.
- $container : array<string|int, mixed>
- Container for storing services.
- $currentRoute : array<string|int, mixed>
- The current route being dispatched.
- $dispatcher : Dispatcher
- The FastRoute dispatcher.
Methods
- __construct() : mixed
- Requires a Tsugi Launch object for initializing.
- dispatch() : Response
- Dispatch request and return response.
- make() : mixed
- Make an instance of a class.
- offsetExists() : bool
- ArrayAccess implementation
- offsetGet() : mixed
- offsetSet() : void
- offsetUnset() : void
- run() : void
- Run the application and send the response.
- setDispatcher() : void
- Set the FastRoute dispatcher instance.
- tsugiFlashError() : mixed
- tsugiFlashError - Add an error message to the flash session.
- tsugiFlashSuccess() : mixed
- tsugiFlashSuccess - Add a success message to the flash session.
- tsugiRedirect() : mixed
- tsugiRedirectHome() : mixed
- tsugiReroute() : mixed
- tsugiReroute - Send the browser to a new location with session
- beforeControllerAction() : void
- Run before a controller method. Tsugi uses this for session gates.
- call() : mixed
- Call a callable with parameters.
- callActionOnArrayBasedRoute() : mixed
- Call the Closure or invokable on the array based route.
- callControllerAction() : mixed
- Call a controller based route.
- createDispatcher() : Dispatcher
- Create a FastRoute dispatcher instance for the application.
- handleDispatcherResponse() : mixed
- Handle the response from the FastRoute dispatcher.
- handleFoundRoute() : mixed
- Handle a route found by the dispatcher.
- parseIncomingRequest() : array<string|int, mixed>
- Parse the incoming request and return the method and path info.
- prepareResponse() : Response
- Prepare the response for sending.
- resolveExceptionHandler() : ExceptionHandler
- Resolve the exception handler.
- sendExceptionToHandler() : Response
- Send exception to handler.
Properties
$router
The router instance.
public
Router
$router
$container
Container for storing services.
protected
array<string|int, mixed>
$container
= []
$currentRoute
The current route being dispatched.
protected
array<string|int, mixed>
$currentRoute
$dispatcher
The FastRoute dispatcher.
protected
Dispatcher
$dispatcher
Methods
__construct()
Requires a Tsugi Launch object for initializing.
public
__construct(mixed $launch[, mixed $basePath = __DIR__ ]) : mixed
$launch = \Tsugi\Core\LTIX::requireData(); $app = new \Tsugi\Lumos\Application($launch);
The launch object is added to the $app variable and can be accessed as follows:
$app['tsugi']->user->displayname;
Parameters
- $launch : mixed
- $basePath : mixed = __DIR__
dispatch()
Dispatch request and return response.
public
dispatch([Request|null $request = null ]) : Response
Parameters
- $request : Request|null = null
Return values
Responsemake()
Make an instance of a class.
public
make(string $class) : mixed
Parameters
- $class : string
offsetExists()
ArrayAccess implementation
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
offsetSet()
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
offsetUnset()
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
run()
Run the application and send the response.
public
run([Request|null $request = null ]) : void
Parameters
- $request : Request|null = null
setDispatcher()
Set the FastRoute dispatcher instance.
public
setDispatcher(Dispatcher $dispatcher) : void
Parameters
- $dispatcher : Dispatcher
tsugiFlashError()
tsugiFlashError - Add an error message to the flash session.
public
tsugiFlashError(mixed $message) : mixed
Parameters
- $message : mixed
tsugiFlashSuccess()
tsugiFlashSuccess - Add a success message to the flash session.
public
tsugiFlashSuccess(mixed $message) : mixed
Parameters
- $message : mixed
tsugiRedirect()
public
tsugiRedirect(mixed $route) : mixed
Parameters
- $route : mixed
tsugiRedirectHome()
public
tsugiRedirectHome() : mixed
tsugiReroute()
tsugiReroute - Send the browser to a new location with session
public
tsugiReroute(mixed $route) : mixed
Usage: $app->router->get('/', 'AppBundle\Attend@get'); $app->router->post('/', 'AppBundle\Attend@post');
Then at the end of the POST code, do this:
return $app->tsugiReroute('main');
Parameters
- $route : mixed
beforeControllerAction()
Run before a controller method. Tsugi uses this for session gates.
protected
beforeControllerAction(object $instance, string $method) : void
Parameters
- $instance : object
- $method : string
call()
Call a callable with parameters.
protected
call(callable $callable[, array<string|int, mixed> $parameters = [] ]) : mixed
Parameters
- $callable : callable
- $parameters : array<string|int, mixed> = []
callActionOnArrayBasedRoute()
Call the Closure or invokable on the array based route.
protected
callActionOnArrayBasedRoute(array<string|int, mixed> $routeInfo) : mixed
Parameters
- $routeInfo : array<string|int, mixed>
callControllerAction()
Call a controller based route.
protected
callControllerAction(array<string|int, mixed> $routeInfo) : mixed
Parameters
- $routeInfo : array<string|int, mixed>
createDispatcher()
Create a FastRoute dispatcher instance for the application.
protected
createDispatcher() : Dispatcher
Return values
DispatcherhandleDispatcherResponse()
Handle the response from the FastRoute dispatcher.
protected
handleDispatcherResponse(array<string|int, mixed> $routeInfo) : mixed
Parameters
- $routeInfo : array<string|int, mixed>
handleFoundRoute()
Handle a route found by the dispatcher.
protected
handleFoundRoute(array<string|int, mixed> $routeInfo) : mixed
Parameters
- $routeInfo : array<string|int, mixed>
parseIncomingRequest()
Parse the incoming request and return the method and path info.
protected
parseIncomingRequest(Request $request) : array<string|int, mixed>
Parameters
- $request : Request
Return values
array<string|int, mixed>prepareResponse()
Prepare the response for sending.
protected
prepareResponse(mixed $response) : Response
Parameters
- $response : mixed
Return values
ResponseresolveExceptionHandler()
Resolve the exception handler.
protected
resolveExceptionHandler() : ExceptionHandler
Return values
ExceptionHandlersendExceptionToHandler()
Send exception to handler.
protected
sendExceptionToHandler(Throwable $e) : Response
Parameters
- $e : Throwable