How to fix "Fatal error: Interface ‘Zend\ModuleManager\Feature\AutoloaderProviderInterface’ not found
I am creating a module on ZF2 .
I tried different ways creating Module.php , but am not getting output. Not sure where i am getting wrong.
<?php
namespace Admin;
use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
use Zend\ModuleManager\Feature\ConfigProviderInterface;
class Module implements AutoloaderProviderInterface, ConfigProviderInterface
{
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
);
}
public function getConfig()
{
return include __DIR__ . '/../config/module.config.php';
}
}
This is the error message i am getting :
Fatal error: Interface ‘Zend\ModuleManager\Feature\AutoloaderProviderInterface’ not found in C:\xampp\htdocs\project\module\Admin\src\Module.php on line 8
Is zendframework/zend-modulemanager in your composer.lock and in vendor/zendframework ?
Yes, it is.
Did you include __DIR__ . '/vendor/autoload.php somewhere at the startup of your application?
Yes, i did create the file as admin.php and previously tried with include __DIR__ . '/vendor/autoload.php - but was getting errors as below :
Warning : include(C:\xampp\htdocs\project\module\Admin/…/vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\project\module\Admin\admin.php on line 18
Warning : include(): Failed opening ‘C:\xampp\htdocs\project\module\Admin/…/vendor/autoload.php’ for inclusion (include_path=‘C:\xampp\php\PEAR’) in C:\xampp\htdocs\project\module\Admin\admin.php on line 18
But only last vendor module is working, and other two user and admin module are not working. So is that i will require to create different autoload snippet for admin and user module and add in composer.json ?
Yes, have created module classes and registered modules, already followed whatever was suggested by you and repeated same again, but still same results. Is that i am missing something?
Another option could be that you have module_map_cache_enabled in application.config.php set to true.
In that case it can’t hurt to go to the data/cache/ directory and just delete all files starting with "module-".