Class not found when using a namespace
Permalink
I have an addon that someone is attempting to install. They are receiving this error:
In the file where this is called, the Installer class is referenced and aliased, such as:
In my development and testing, I haven't had any issues. The person installing it is running PHP 5.3.10. I'm running 5.6.x. Do you think the version difference could be causing the problem?
The Installer class is also being called statically. Could this be the issue?
Thanks for your help.
Class 'Concrete\Package\MyPackage\Core\Installer' not found
In the file where this is called, the Installer class is referenced and aliased, such as:
use Concrete\Package\MyPackage\Core\Installer as Installer;
In my development and testing, I haven't had any issues. The person installing it is running PHP 5.3.10. I'm running 5.6.x. Do you think the version difference could be causing the problem?
The Installer class is also being called statically. Could this be the issue?
Thanks for your help.
Could you share the path of your file?
The package controller is at
And the called 'Installer' is at
{root}/packages/my_package/controller.php
And the called 'Installer' is at
{root}/packages/my_package/Core/Installer.php
OK, I think you should change the directory
/packages/my_package/src/Installer.php
namespace Concrete/Package/MyPackage/Src;
class Installer
/packages/my_package/src/Installer.php
namespace Concrete/Package/MyPackage/Src;
class Installer
Are you recommending that I create a 'Src' directory and put everything there? Instead of the 'Core' directory?
Yes. Because the Autoloader had changed recently.
https://github.com/concrete5/concrete5-5.7.0/commit/3795a80724844d41...
https://github.com/concrete5/concrete5-5.7.0/commit/3795a80724844d41...
Do you have more questions about this? I'd like to use PageList+ in 5.7, but 5.7.0.0.1 package still use Core directory... I'll be happy to help you to make it compatible with latest 5.7.