I'm curious about building CMS components on top of the Joomla! Framework mainly because I would like my components to function as standalone applications.

Is this doable without hacks? If not, is there a preffered way to approach this?

  • 1
    What MVC structure do you use for your component: Legacy or not? Commented May 7, 2014 at 19:38
  • Good question, non-legacy. Commented May 7, 2014 at 19:59

1 Answer 1


This question is impossible to answer conclusively, but I think that it is worthwhile to take a stab at some of the most common pieces that could trip you up in porting code over (and there will be quite a few).

Before getting in to specifics, all of this could be considered a hack, depending on your point of view. The CMS and Framework are very different from a component's standpoint. The CMS defines the exact structure to use. The Framework is designed to let you customize how your application runs and interacts. The Framework can definitely be designed to run components from the CMS, but at a certain point this is just you recreating the CMS, which seems pointless.

First, the super short and simple answer: every way that your component interacts with the CMS needs to be redone, you will need to add a router, and you probably have to add namespaces or a new autoloader.

Let's start with the second half of this. Odds are that you are using composer with the Joomla Framework, so you can bank on composer's autoloader loading up the classes as you need them. This is designed to run within namespaces and load based on that, so your component won't autoload. (I'm guessing on this, so if there is a better way, someone please comment.) This means that you either have to add your own autoloader for the MVC classes or rewrite them in a namespace.

Second, you will need to add your own router file to the application. Since you no longer have the menu manager, you will need to recreate this using the Router class. This is actually pretty straightforward to map urls to a controller, but you have to make sure this is in the application.

Finally, you have to support any CMS feature that you use in the component. The biggest one that comes to mind is JFactory. Any script that calls that class to get the session, database, or document will not work. (Unless you port that class over and redefine its hooks to suit your application.

Do you call JComponentHelper somewhere? You would have to add support for that. Do you call to another helper for a core extension like com_content or com_users? That won't work either anymore.

You could get some simple extensions running on the framework easily. Those that hook into the CMS in lots of ways may require basically rebuilding the CMS to do all the pieces. This part really depends on the extension.

In closing, at this stage, it will most likely involve some type of hacking or copy/pasting of code form the CMS to the framework that you need.

I believe that the CMS will become more in line with the structure of the framework (i.e. uses composer, uses namespaces, etc.) that will make this easier. Right now, it is a pretty daunting task, though.

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.