I want to make a namespace for my Joomla components, but I can't find a clear example.

I want to declare multiple classes in my namespace and use autoloading.

For example:


Then I want to only have to put use namespacebas\xml; at the top of my php file.

Can anyone help me with a simple example which I can easily customize to my needs?

1 Answer 1


I found the answer finaly i greated an example on github for who is intrested: https://github.com/basd82/joomla_libarary

  • Answers must never be solely comprised of a hyperlink. Please post a static solution here so that a deadlink doesn't present a deadend to researchers. Commented May 2, 2020 at 12:18
  • @mickmackusa it are muttipel files en plugin script i don't i should post all the code here! Commented May 3, 2020 at 13:48
  • 1
    I haven't yet clicked your link to see how much code there is, but it is a hard, long-lasting rule that link-only answers are not complete answers -- because they are prone to breakage over time. Please post your snippets as separate/named code blocks in your answer. For example: joomla.stackexchange.com/a/24314/12352 Commented May 3, 2020 at 22:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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