class App (View source)

Constants

VERSION

Inphinit framework version

Methods

static mixed
config(string $key, $value = null)

Get application configs

static void
trigger(string $name, array $args = array())

Trigger registered event

static int
state()

Return application state

static void
on(string $name, callable $callback, int $priority = 0)

Register an event

static void
off(string $name, callable $callback = null)

Unregister 1 or all events

static void
stop(int $code, string $msg = null)

Stop application, send HTTP status

static void
exec()

Start application using routes

static 
dispatch()

Dispatch before ready event if exec is Ok, or dispatch after finish event if stop() is executed

Details

static mixed config(string $key, $value = null)

Get application configs

Parameters

string $key
$value

Return Value

mixed

static void trigger(string $name, array $args = array())

Trigger registered event

Parameters

string $name
array $args

Return Value

void

static int state()

Return application state

  • 0 - Unexecuted - `App::exec()` is not executed
  • 1 - Initiated - `App::exec()` is executed
  • 2 - Interactive - After dispatch headers and views
  • 3 - Ready - After show return in output
  • 4 - Finished - Defined after trigger finish event
  • 5 - Error - Defined after trigger an error event (by user or by script)

Return Value

int

static void on(string $name, callable $callback, int $priority = 0)

Register an event

Parameters

string $name
callable $callback
int $priority

Return Value

void

static void off(string $name, callable $callback = null)

Unregister 1 or all events

Parameters

string $name
callable $callback

Return Value

void

static void stop(int $code, string $msg = null)

Stop application, send HTTP status

Parameters

int $code
string $msg

Return Value

void

static void exec()

Start application using routes

Return Value

void

static dispatch()

Dispatch before ready event if exec is Ok, or dispatch after finish event if stop() is executed