Universeorange.com/Docs/
The
App class
has these methods.
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:
$controller::controller()
$controller::configure()
$controller::before_run()
Then the method is called which is defined in the route; for example:
$controller::run()
Then after the route defined method these functions are called (if defined):
$controller::after_run()
$controller::before_result()
App::result()
$controller::after_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
.
append
, replace
, replace-with
or replace-with-or-append-to
.id
or class
of the element.id
or class
of the element.javascript
which will be added to the <head>
element.css
which will be added to the <head
> element.$app->route();
Return the route object.
$app->config($attribute=null, $value=null);
$attribute
value of the configuration.$attribute
configuration option with $value
.$app->request($attribute=null, $value=null);
$attribute
value of the request.$attribute
with $value
in the request.App::parameter(App $object, $parameter='', $offset=0);
Used in cli to read the parameters of the request.
$app->session($attribute=null, $value=null);
$attribute
value of the session.$attribute
with $value
in the session.$app->cookie($attribute=null, $value=null);
$attribute
value of the cookie.$attribute
with $value
in the cookie.$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.
$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.
App::is_cli();
Checks if the app is in cli mode.
Last modified: 2021-06-07
© 2021 universeorange.com