Jump to content

Modules Autoloader


ShaunR

Recommended Posts

I think with v7 a autoloader was added that allowed modules to autoload from the lib directory.  Does this autoloader not allow loading of libs from other modules?

For example, I have a addon module called addonModule with a lib called AddonLib. I want to access that AddonLib from a serverModule. I did the following but am getting and error.

 

#AddonLib
namespace WHMCS\Module\Addon\AddonModule
class AddonLib {}

#ServerModule
use WHMCS\Module\Addon\AddonModule\AddonLib;
$addonLib = AddonLib();


#Error
Error: Call to undefined function WHMCS\Module\Addon\AddonModule\AddonLib() in /home/dev/public_html/modules/servers/servermodule/servermodule.php:29
Stack trace:
#0 /home/dev/public_html/vendor/whmcs/whmcs-foundation/lib/Module/AbstractModule.php(0): servermodule_ConfigOptions(Array)
#1 /home/dev/public_html/vendor/whmcs/whmcs-foundation/lib/Module/Server.php(0): WHMCS\Module\AbstractModule->call('ConfigOptions', Array)
#2 /home/dev/public_html/admin/configproducts.php(0): WHMCS\Module\Server->call('ConfigOptions', Array)
#3 {main}

 

Edited by ShaunR
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated