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.

How to use Phalcon Micro as a service?

I need to use \Phalcon\Mvc\Micro as a service.

$di = new FactoryDefault();

$di->set('app', function () use ($di) {
    $app = new Micro($di);
    return $app;


i did apply the above mention approach but it did not get do what i wanted. Please give me a direction.

And what is exactly your problem? Just access $di->app

Also why you want to do it?

edited Mar '17

I wanted to use the instance of Micro from anywhere in my project. I have found a way to use that. $app = new Micro(); $app->setDI($di); thank you

$app = new Micro(); $app->setDI($di);

Exactly, this is correct way to do this :)