class ApplicationMixin (View source)

Can be applied to your App class via a "@mixin" annotation for better IDE support.

This class is not meant to be used in any other capacity.

Methods

static boolean
isBootstrapped()

Get whether the application has been bootstrapped.

static void
bootstrap(array $config = [], boolean $run = true)

Bootstrap the application.

static Container
container()

Get the IoC container instance.

static void
setContainer(Container $container)

Set the IoC container instance.

static mixed|null
resolve(string $key)

Resolve a dependency from the IoC container.

static Application
app()

Get the Application instance.

static ClosureFactory
closure()

Get the ClosureFactory instance.

static Csrf
csrf()

Get the CSRF service instance.

static Flash
flash()

Get the Flash service instance.

static OldInput
oldInput()

Get the OldInput service instance.

static ResponseInterface
run(RequestInterface $request, string[] $middleware, string|Closure $handler, array $arguments = [])

Run a full middleware + handler pipeline independently of routes.

static ResponseService
responses()

Get the ResponseService instance.

static ResponseInterface
response()

Create a "blank" response.

static ResponseInterface
output(string $output)

Create a response with the specified string as its body.

static ResponseInterface
json(mixed $data)

Create a response with the specified data encoded as JSON as its body.

redirect()

Create a redirect response.

static ResponseInterface
error(integer $status)

Create a response with the specified error status code.

static ViewService
views()

Get the ViewService instance.

static ViewInterface
view(string|string[] $views)

Create a view.

static void
layoutContent()

Output child layout content.

static RouteBlueprint
route()

Create a new route.

static void
render(string|string[] $views, array $context = [])

Output the specified view.

Details

static boolean isBootstrapped()

Get whether the application has been bootstrapped.

Return Value

boolean

static void bootstrap(array $config = [], boolean $run = true)

Bootstrap the application.

Parameters

array $config
boolean $run

Return Value

void

static Container container()

Get the IoC container instance.

Return Value

Container

static void setContainer(Container $container)

Set the IoC container instance.

Parameters

Container $container

Return Value

void

static mixed|null resolve(string $key)

Resolve a dependency from the IoC container.

Parameters

string $key

Return Value

mixed|null

static Application app()

Get the Application instance.

Return Value

Application

static ClosureFactory closure()

Get the ClosureFactory instance.

Return Value

ClosureFactory

static Csrf csrf()

Get the CSRF service instance.

Return Value

Csrf

static Flash flash()

Get the Flash service instance.

Return Value

Flash

static OldInput oldInput()

Get the OldInput service instance.

Return Value

OldInput

static ResponseInterface run(RequestInterface $request, string[] $middleware, string|Closure $handler, array $arguments = [])

Run a full middleware + handler pipeline independently of routes.

Parameters

RequestInterface $request
string[] $middleware
string|Closure $handler
array $arguments

Return Value

ResponseInterface

See also

HttpKernel::run

static ResponseService responses()

Get the ResponseService instance.

Return Value

ResponseService

static ResponseInterface response()

Create a "blank" response.

Return Value

ResponseInterface

See also

ResponseService::response

static ResponseInterface output(string $output)

Create a response with the specified string as its body.

Parameters

string $output

Return Value

ResponseInterface

See also

ResponseService::output

static ResponseInterface json(mixed $data)

Create a response with the specified data encoded as JSON as its body.

Parameters

mixed $data

Return Value

ResponseInterface

See also

ResponseService::json

static RedirectResponse redirect()

Create a redirect response.

static ResponseInterface error(integer $status)

Create a response with the specified error status code.

Parameters

integer $status

Return Value

ResponseInterface

See also

ResponseService::error

static ViewService views()

Get the ViewService instance.

Return Value

ViewService

static ViewInterface view(string|string[] $views)

Create a view.

Parameters

string|string[] $views

Return Value

ViewInterface

See also

ViewService::make

static void layoutContent()

Output child layout content.

Return Value

void

See also

PhpViewEngine::getLayoutContent

static RouteBlueprint route()

Create a new route.

Return Value

RouteBlueprint

static void render(string|string[] $views, array $context = [])

Output the specified view.

Parameters

string|string[] $views
array $context mixed> $context

Return Value

void

See also

ViewService::make
ViewInterface::toString