Can we have a micro application section?
I want to use the micro framework in a more dynamic way, here is some code snippet from the documentation:
<?php
// With a function
function say_hello($name) {
echo "<h1>Hello! $name</h1>";
}
$app->get('/say/hello/{name}', "say_hello");
// With a static method
$app->get('/say/hello/{name}', "SomeClass::someSayMethod");
// With a method in an object
$myController = new MyController();
$app->get('/say/hello/{name}', array($myController, "someAction"));
//Anonymous function
$app->get('/say/hello/{name}', function ($name) {
echo "<h1>Hello! $name</h1>";
});
Notice that you can call functions from objects and static functions as well, my question is, how I can access the $app object and also how I can access the DI from inside those functions?
The defined Dirs, Namespaces and Classes under \Phalcon\Loader are available at that scope?
Thanks.