Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Once we've enabled the Joomla! support, PhpStorm then asks if we would like to enable the Joomla! code styles and if we would like to enable the Joomla! docblock templates. Joomla! has its own rigorous code style and docblocks, so enabling these is always a good idea; we'll learn more about these later.

Creating a New Joomla Module/Plugin/Extension

To create a new Joomla project, go to File then New Project... and select Joomla! Integration from the left hand options. You'll need to tell PhpStorm where to find your Joomla! installation path, give your project a name and select what type of Joomla! project you're going to create. Here we're creating a new Joomla! module.

Image Added

PhpStorm will then create the `joomla-module.php` file, and the `joomla-module.xml` file that you need to use this project as a Joomla! module. You'll need to edit the configuration XML file before you can use the module.

Development Environment Configuration

Joomla! Include Paths

With Joomla! support enabled and PhpStorm knowing where your Joomla! install is, then the path to this Joomla! install should be included in your include paths by default. You can check this by selecting External Libraries in the left-hand project browser, and check that you can see joomla library root under PHP. If you don't see this, you'll need to add the path to your Joomla! install to your project manually in the usual way.

Joomla! Coding Standard (Code Style)

PhpStorm ships with a coding standard for Joomla! code style, and you should be asked if you want to enable this when you enable Joomla! support. If you wish to enable the Joomla! code style manually, browse to Editor, Code Style then PHP in the preference pane. There, you can add the pre-defined Joomla! styles by clicking Set From..., and selecting Predefined Style then Joomla!

Image Added

JHtml::_($argument) and JText::_($argument) support

...

  • All the available methods of JHtml are available in the completion list 
  • Additional tips for required parameters



  • When clicking on the identifying $argument the actual subclass plus method are opened (Ask Andrey to help to reproduce)


The latest versions of PhpStorm come with support for the _ static method of the `\JHtml' class. This is a magic method that allows you to invoke helpers by passing in a string that contains the class name plus the method name, separated by a dot. PhpStorm can parse these strings, and provide you with the usual helpers associated with class and method names in the IDE. For example, here we are using the `form.token` helper, and when we invoke Brief Info over the string (default to CMD/CTRL plus hover over the item) we see the method signature for this helper method:

Image Added

Cmd+Ctrl and clicking the string takes us straight to the `token` static method of the `JHtmlForm` class just as we would expect.

 

JText::_($argument) support

Not done yet

 Databases

 Data source detection

...