PhpStorm 2018.3 Help

Configuring Joomla! Support

PhpStorm checks if the development environment is configured properly for Joomla! development.

Any detected inconsistency is reported in the Event Log tool window and as a pop-up. For each discrepancy PhpStorm suggests a fix. To apply a suggestion, click the link next to the reported event.

JoomlaEventLog

Changing the Joomla! settings

Enable or disable Joomla! integration

  • In the Settings/Preferences dialog (Ctrl+Alt+S), navigate to Languages and Frameworks | PHP | Frameworks. On the Frameworks page that opens, toggle the Enable Joomla! integration checkbox to activate or deactivate Joomla! in the current PhpStorm project.
    To use another Joomla! installation, type the path to the relevant installation folder.

Set the code style

  • In the Settings/Preferences dialog (Ctrl+Alt+S), navigate to the Editor | Code Style | PHP page and update the settings as necessary.

Checking code against the Joomla coding standards

With PhpStorm, you can use the PHP Code Sniffer tool, which detects coding standard issues, in combination with Joomla Coding Standards, which provides a set of Joomla-specific standards to PHP Code Sniffer. This will ensure that your code is clean, consistent, and free of some common errors.

To get started, install PHP Code Sniffer using any technique described in Installing and configuring PHP Code Sniffer. Probably the easiest way is to install it with Composer.

Install PHP Code Sniffer

  1. On the context menu of composer.json, choose Composer | Manage Dependencies. Alternatively choose Tools | Composer | Manage Dependencies from the main menu.

  2. In the Manage Composer Dependencies Dialog that opens, select the squizlabs/php_codesniffer package from the Available Packages list, possibly using the search field.

    Choose the relevant version from the Version to install list.

  3. If necessary, expand the Settings hidden area and specify the advanced installation options. In the Command line parameters field, type the additional command line parameters. It is recommended to provide the --dev, option: the package in this case is added to the require-dev section of the composer.json file instead of the default require section.

  4. Click Install.

Next, install Joomla Coding Standards, which will provide Joomla-specific standards to PHP Code Sniffer.

Install Joomla Coding Standards

  1. On the context menu of composer.json, choose Composer | Manage Dependencies. Alternatively choose Tools | Composer | Manage Dependencies from the main menu.

  2. In the Manage Composer Dependencies Dialog that opens, select the joomla/coding-standards package from the Available Packages list, possibly using the search field.

    Choose the relevant version from the Version to install list.

  3. If necessary, expand the Settings hidden area and specify the advanced installation options. In the Command line parameters field, type the additional command line parameters. It is recommended to provide the --dev, option: the package in this case is added to the require-dev section of the composer.json file instead of the default require section.

  4. Click Install.

The Joomla Coding Standards package will be installed, and the corresponding Joomla standard will be selected for the PHP Code Sniffer validation inspection automatically. If necessary, you can further customize the inspection on the Editor | Inspections page of the Settings/Preferences dialog (Ctrl+Alt+S). See Configuring PHP Code Sniffer as a PhpStorm inspection for details.

Last modified: 18 March 2019

See Also

Reference: