I'd like to develop Joomla components with VS Code. With PHP Intelephense enabled, all my file show errors because I use Joomla classes and functions. (And it would also be convenient to have auto complete for Joomla functions)

To solve the same problem with WordPress, one can just add wordpress to the intelephense.stubs array in the settings. Unfortunately there are no stubs for Joomla, but it is possible to add your own stub files.

Is there a way to generate a stubs file for Joomla, or does it already exist and can be downloaded?

Additional remark

I develop the extension in a separate directory, so I have all of the files in one place and the editor and git is not cluttered with the Joomla files. Therefore the editor doesn't see the Joomla classes and functions. The setting intelephense.environment.includePaths seems to be a solution for this issue.
But I'm still wondering if there is a way to do via the stubs approach (the way it's solved for WordPress), so I don't have to add the includePaths for every project.


Running build/stubGenerator.php script results in this error (on Linux)

Error: Failed to start application: Class Joomla\CMS\Filesystem\Support\StringController does not exist% 

If I change the file name of ./joomla-cms-staging/libraries/src/Filesystem/Support/Stringcontroller.php to StringController.php, the script finishes without an error. But the generated file (stubs.php) doesn't appear to be complete (at least to me). Every entry looks like this (total of 1877 lines):

 * @deprecated 5.0 Use Joomla\... instead.
class ... extends Joomla\... {}

2 Answers 2


When running Joomla from git clone you can use build/stubGenerator.php script. It will generate stubs.php file in Joomla's root directory.

  • I tried that, but I get an error. See update in question.
    – jost21
    Nov 3, 2020 at 12:47
  • This is a known issue caused by incorrectly cased file. It hasn't been fixed in core yet. As a workaround you can rename Stringcontroller.php in libraries/src/Filesystem/Support to StringController.php.
    – Sharky
    Nov 4, 2020 at 6:42
  • I already did that, but there are only @deprecated classes (375 of them) in the stubs.php file (more details in the question update). I'm not sure but it doesn't feel like that is what it should be, is it?
    – jost21
    Nov 4, 2020 at 8:41
  • Yes, that's what the script does. Other classes should be picked up automatically by your editor.
    – Sharky
    Nov 5, 2020 at 8:42
  • Sorry, maybe I should have been more clear. I develop my extension in a separate directory, the Joomla installation is in a different location and the editor doesn't have access to it. I found the setting intelephense.environment.includePaths yesterday, that seems to solve the problem. But I'm still wondering if there is a similar approach than there is for WordPress, for which you just add stubs.
    – jost21
    Nov 5, 2020 at 9:06

Not sure why a intelephense.environment.includePaths is not useful for you, even when you can have a git clone of joomla in your environment, keep up to date (even you can change of branch for handle different versions) and point to there any new workspace folder you working on. You can set up globally, in this way any new workspace will have it, but is better have all this settings for each workspace in my opinion - this if you do not work only with Joomla.

About intelephense.stubs For single workspace it is very simple, and I follow the same I wrote before about having a git clone of joomla. If you want add stubs globally, you still can, but I'm not sure if it's intended feature with custom stubs.

About the error you mention, I just rebuild again in Linux/Ubuntu and without problem

  • intelephense.environment.includePaths is useful to me :), I like mentioned that's what I currently use. I'm just wondering if there is a similar way to the wordpress approach (set intelephense.stubs to wordpress or adding custom stubs for Joomla).
    – jost21
    Oct 6, 2021 at 20: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.