2

I've added the namespace line to my manifest xml: <namespace>Mycompany\Component\Mycomponent</namespace>

When I install the component, I'm not seeing any alias added to the libraries/vendor/composer/autoload_psr4.php -- should Joomla regenerate that file with each component installed?

Is there any other places (besides just the namespaces in the classes themselved) that I need to register my namespace?

  • As @Sharky mentioned to you in his comment at your previous question: the Namespacemap Plugin should be turned on and that will update/create a new namespacemap for your component after a successful install. – Zollie Dec 9 '19 at 8:59
  • @Zollie -- thanks. Is that plugin not enabled by default? – user101289 Dec 9 '19 at 18:45
  • It is actually enabled by default and as it's description says: "Automatically builds and updates the libraries\autoload_psr4.php file that is used to autoload extensions." – Zollie Dec 9 '19 at 19:08
  • I have not checked the newer alphas of J4 but earlier there were issues with updating the classmap at extension install: github.com/joomla/joomla-cms/issues/20953. – Zollie Dec 9 '19 at 20:16
2

Thanks to @Zollie-- the plugin is enabled by default and does seem to work. You'd need to check the libraries/autoload_psr4.php to verify that your component's namespace (set in the new namespace parameter in the manifest xml) is being generated correctly.

The default namespace format for custom components is DeveloperName\Component\ComponentName.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.