Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Getting controller name and action in micro

Is there a way to get the controller name and action called in a micro app?

I currently have this in the code:

$eventsManager->attach('micro', function($event, $app) { if ($event->getType() == 'beforeExecuteRoute') {

} });


A micro application does not have the concept of controllers. A micro application executes handlers according to a matched route. You can control access by using the uri:

$eventsManager->attach('micro', function($event, $app) {
    if ($event->getType() == 'beforeExecuteRoute') {
        if ($app['router']->getRewriteUri() == '/login') {
            // ...


Thanks, that will be helpful with what I want to do.