How do I fix the Laminas HelperPluginManager already being declared in laminas-view?

162 Views Asked by At

I have just upgraded an old Zend Framework (version 2) project using the laminas migration package. All worked well during the migration but now I get an error when trying to view the site;

Warning: Class "Laminas\View\HelperPluginManager" not found in /vendor/laminas/laminas-zendframework-bridge/src/Autoloader.php on line 114

Fatal error: Cannot declare class Zend\View\HelperPluginManager, because the name is already in use in /vendor/laminas/laminas-view/src/HelperPluginManager.php on line 0

The version of laminas installed is 2.2.10 and I’m using PHP 7.4. It seems I cannot use the latest version of laminas as I’m not using PHP 8 which I can use as we need 7.4.

How can I use Laminas\View\HelperPluginManager and not the Zend\View\HelperPluginManager?

1

There are 1 best solutions below

0
MagsSwe On

I screwed up on my very first post here and posted a question as an answer. Sorry.

Anyhow! I managed to solve the issue that gave me the exact fatal error as the original post. I never received the warning.

To solve it, I had to remove and reinstall laminas/laminas-view.

composer remove laminas/laminas-view

composer require laminas/laminas-view

Hope this helps.