Anonymous function in router

Is it possible to pass anonymous function to router? Something like this?

$router->add('/page', function() { echo ' this is my page'; });

?



83.5k

If you use a Micro MVC yes: http://docs.phalconphp.com/en/latest/reference/micro.html

<?php

$app = new Phalcon\Mvc\Micro();

$app->get('/say/welcome/{name}', function ($name) {
    echo "<h1>Welcome $name!</h1>";
});

$app->handle();


2.6k

Thanks, I assume there is no other way if I'm not using micro mvc?