I like to develop a fresh Joomla Component for Joomla 3.x in Eclipse and created therefore a simple PHP project.

The problem I have is now how to setup the correct "include path", so that the basic Joomla PHP classes get found by the PHP compiler inside eclipse at coding time like "JFactory" , "JAccess", "JObject" ...

If I just include a Joomla installation in my include path, this will not work. I assume the paths to the classes are more sophisticated than that.

Any Idea or suggestion how the "include path" for my project should look like?

regards Mark


I'm a little confused by created therefore a simple PHP project so I'll assuming by this you're referring to your component.

Basically, all Joomla clases (Jxxx) are autoloaded (I think with exception of a couple such as JFolder, JFile, and a few others), so you can just access them directly without having to import them:

$user = JFactory::getUser();
$access = JAccess::getGroupsByUser($user->get('id'));
$object = new JObject();

You can of course call the namespaced class names instead, like so:

use Joomla\CMS\Factory;
use Joomla\CMS\Access\Access;
use Joomla\CMS\Object\CMSObject;

class Foo
    function test()
        $user = Factory::getUser();
        $access = Access::getGroupsByUser($user->get('id'));
        $object = new CMSObject; 
  • Thanks but I am referring to the include path of the PHP compiler inside eclipse at development time not at runtime. There will no autoload be used except there is a trick to activate it? – megloff Mar 22 at 9:06

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.