PhpStorm and the Joomla! configuration file

The Joomla configuration file is not only used by Joomla but also PhpStorm uses it to understand how your Joomla site is setup. The configuration file helps PhpStorm to add extra features to the editor.

The extra features that are added are:

  • Create database connection
  • DatabaseQuery completion

PhpStorm expects only one configuration.php to be present in your installation. If there are other JConfig classes available in your installation they should be disabled.

Finding out if you have more than one JConfig class available:

  1. Open any PHP file in your project
  2. Add the following code, this instantiates the JConfig class
    (new JConfig);
  3. On the JConfig hit CTRL-B / CMD-B to see if you get multiple references like this:
    PhpStorm find JConfig classes
    PhpStorm find JConfig classes
  4. In this case PhpStorm finds 2 files where the JConfig class is defined. The first entry is the correct one, so we need to disable the second one as that is just a test class.

To disable a file take these steps:

  1. Open the file with the JConfig class that should be ignored
  2. Hit CTRL-SHIFT-A / CMD-SHIFT-A to open the Search action field
  3. Type in the search box Mark as Plain Text
  4. Select the option or hit Enter
  5. The file will now lose the highlighting
  6. The file is now ignored by PhpStorm

Now that there is only one JConfig available, PhpStorm will use this to make the features available.