Universeorange.com/Docs/

R3m/framework Features App class

The App class has these methods.

Methods:

Run

App::run(App $object);

App::run() initializes the App and runs the application through a controller.

$dir = __DIR__;
$dir_vendor =
    dirname($dir, 1) .
    DIRECTORY_SEPARATOR .
    'vendor' .
    DIRECTORY_SEPARATOR;

$autoload = $dir_vendor . 'autoload.php';
$autoload = require $autoload;
$config = new R3m\Io\Config(
    [
        'dir.vendor' => $dir_vendor
    ]
);
// $config->data('framework.environment', R3m\Io\Config::MODE_DEVELOPMENT);
$app = new R3m\Io\App($autoload, $config);
echo R3m\Io\App::run($app);

The controller class method is called based on the defined route.
Before the controller method is called it runs these methods if defined in the controller:

Then the method is called which is defined in the route; for example:

Then after the route defined method these functions are called (if defined):

Result

App::result(App $object, $output);

In case of a json result, the App::result() method adds a few things to the output:

{
  "html" : "{$output}",
  "method" : "{$method}",
  "target" : "{$target}",
  "append" : {
      "to" : "{$append.to}"
  },
  "script" : "{$script}",
  "link" : "{$link}"
}

In combination with the Priya library this is convenient because the request() method of Priya handles this json.

Route

$app->route();

Return the route object.

Config

$app->config($attribute=null, $value=null);

Request

$app->request($attribute=null, $value=null);

Parameter

App::parameter(App $object, $parameter='', $offset=0);

Used in cli to read the parameters of the request.

Session

$app->session($attribute=null, $value=null);

Cookie

$app->cookie($attribute=null, $value=null);

Data_read

$app->data_read($url, $attribute=null);

Read json data into the Data class and returns it.
$attribute is used to store the data in $app->data(), you can use sha1($url) here.

Parse_read

$app->parse_read($url, $attribute=null);

Read and parses json data into the Data class and returns it.
$attribute is used to store the data in $app->data(), you can use sha1($url) here.

Is_cli

App::is_cli();

Checks if the app is in cli mode.

Last modified: 2021-06-07

© 2021 universeorange.com