class App (View source)

Constants

VERSION

Inphinit framework version

Methods

static string|bool|int|float|void
env(string $key, string|bool|int|float $value = null)

Set or get environment value

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

Details

static string|bool|int|float|void env(string $key, string|bool|int|float $value = null)

Set or get environment value

Parameters

string $key
string|bool|int|float $value

Return Value

string|bool|int|float|void

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