WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is my thought, and I could be digging myself a huge hole. That's why I'm here ;)

I am looking to develop a complex application but I want this application to run both as a standalone script as a wordpress plugin. Later I may develop into a Joomla plugin and so on.

My thought is I develop an abstract custom framework and then implement the custom functionality via extending this framework. Does that make sense?

So say WP_Plugin extends My_Engine, and then that plugin class will act as factory to manage the custom functionality in the WordPress /lib/wordpress/ directory.

I really don't want to have to repeat myself and I would definitely be producing multiple versions of the app.

Any thoughts?

share|improve this question

The way I'd go about this is build your standalone application but build into it a bullet proof API that will allow others and yourself leverage the power of your application.

Whichever way you look at it there will be a fair amount of coding to be done each time you visit a different CMS as they all have different ways of dealing with things. If your app has good API controls others could then make their own modules for other CMS's that you never knew existed, thus not limiting you to the likes of WordPress and Joomla.

share|improve this answer
Building a good API and letting others do the dirty work of porting to other environments can indeed be an interesting way to go! – Jan Fabry May 31 '11 at 13:42

Extending via subclassing is possible, but it might limit your possibilities. Maybe you want to allow a third party developer extend My_Engine as My_Super_Engine, but then WP_Plugin would still only use My_Engine.

Instead, you could make WP_Plugin contain a reference to a concrete My_Engine object. This is sometimes called "has_a instead or is_a relationship" (WP_Plugin no longer is of type My_Engine, but it has a reference to My_Engine instead), or "Dependency Injection" (when you instantiate your WP_Plugin and inject the dependency on My_Engine instead of hard-coding it inside).

To give a more detailed answer it might help to have some more info on what your application is supposed to do. How much can you decouple the UI from the application logic? This will probably be the biggest hurdle in keeping the core application portable to other environments.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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