Service 'config' wasn't found in the dependency injection container
To fix this I had to do add the following in the Services.php (where Services are globally registered):
//added this "set"
$di->set(
'config',
function () use ($config) {
return $config;
}
);
//Based on documentation, I only had this
$di['dispatcher'] = function() use ($di) {
$eventsManager = $di->getShared('eventsManager');
$security = new \Phalcon\UserPlugin\Plugin\Security($di);
$eventsManager->attach('dispatch', $security);
$dispatcher = new Dispatcher();
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
};
If you use it independently, then yes, you need to register the config service. Normally, if you use it within an app, you should already have the config service registered.
I was getting the following error:
To fix this I had to do add the following in the Services.php (where Services are globally registered):