Class not found Error after migration

After migration from ZF2 to laminas (MVC) we got a class not found error/warning and our application is not running.

Warning: Class ‘Laminas\View\HelperPluginManager’ not found in PATH/vendor/laminas/laminas-zendframework-bridge/src/Autoloader.php on line 116

Class HelperPluginManager exists in path vendor/laminas/laminas-view/src. The files in this folder and its subfolders are still in the Zend namespace. Is that correct?

Are there any ideas for a solution of this issue?

STACK:

# Time Memory Function Location
1 0.1297 364792 {main}( ) …/index.php:0
2 0.9047 379504 Laminas\Mvc\Application::init( ??? ) …/index.php:59
3 0.9300 672944 Laminas\ModuleManager\ModuleManager->loadModules( ) …/Application.php:252
4 1.0732 791688 Laminas\EventManager\EventManager->trigger( ???, ???, ???, ??? ) …/ModuleManager.php:122
5 1.0732 791688 Laminas\EventManager\EventManager->triggerListeners( ???, ???, ??? ) …/EventManager.php:204
6 1.0733 794296 call_user_func:{[PATH]/vendor/laminas/laminas-eventmanager/src/EventManager.php:443} ( ???, ??? ) …/EventManager.php:443
7 1.0733 794296 Laminas\ModuleManager\Listener\ServiceListener->onLoadModulesPost( ??? ) …/EventManager.php:443
8 1.0794 850296 Laminas\ServiceManager\ServiceManager->get( ???, ??? ) …/ServiceListener.php:211
9 1.0794 851048 Laminas\ServiceManager\ServiceManager->create( ??? ) …/ServiceManager.php:529
10 1.0794 851048 Laminas\ServiceManager\ServiceManager->doCreate( ???, ??? ) …/ServiceManager.php:597
11 1.0794 851048 Laminas\ServiceManager\ServiceManager->createFromFactory( ???, ??? ) …/ServiceManager.php:637
12 1.0797 852592 Laminas\ServiceManager\ServiceManager->createServiceViaCallback( ???, ???, ??? ) …/ServiceManager.php:1096
13 1.0797 852672 call_user_func:{[PATH]vendor/laminas/laminas-servicemanager/src/ServiceManager.php:938} ( ???, ???, ???, ??? ) …/ServiceManager.php:938
14 1.0797 852672 Laminas\Mvc\Service\ViewHelperManagerFactory->createService( ???, ???, ??? ) …/ServiceManager.php:938
15 1.0797 852672 Laminas\Mvc\Service\ViewHelperManagerFactory->createService( ??? ) …/ViewHelperManagerFactory.php:43
16 1.0797 852736 spl_autoload_call ( ??? ) …/AbstractPluginManagerFactory.php:31
17 1.0797 852800 Laminas\ZendFrameworkBridge\Autoloader::Laminas\ZendFrameworkBridge{closure:[PATH]/vendor/laminas/laminas-zendframework-bridge/src/Autoloader.php:89-118}( ??? ) …/AbstractPluginManagerFactory.php:31
18 1.0800 858120 class_alias ( ???, ??? ) …/Autoloader.php:116
1 Like

This looks like a bug: if it is possible to create a small reproducer, consider opening an issue on laminas/laminas-zendframework-bridge, so that someone can investigate it.

I suggest to migrate a ZF2 app to ZF3 app first, then to Laminas

I got the same error with migrating Zend 2 to Laminas, after the migrated I get the following error:

Class 'Laminas\View\HelperPluginManager' not found in vendor\laminas\laminas-zendframework-bridge\src\Autoloader.php Fatal error</b> : Cannot declare class Zend\View\HelperPluginManager, because the name is already in use

I check socurce code of laminas/laminas-view component and see that the namespace of this component is Zend.

image

Version of laminas/laminas-view is 2.3.
Please help me for resolve it.

is it solved for anyone? @trungnv @bhausch? I got the same issue. Please reply

@samsonasik @ocramius do you have any idea?

Hi

I had a similar error, add/update your composer autoload psr entry
and do a

composer dump-autoload

Hi @rajath
Could you be more specific on the changes required to update composer autoload psr entry?

Thanks you.

I add these lines in my composer.json

“autoload”: {
“psr-4”: {“Laminas\View\”: “src/”}
}

and later run: composer dump-autoload

This worked for my

Hello and welcome to our forums! :smiley:

This is not necessary if all the required components of Laminas are correctly installed, because they already bring exactly these lines:

Hi, does anyone have a working solution. None of these solutions work for me.