IntelliJ IDEA 2020.1 Help

Configure Joomla! support

IntelliJ IDEA 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 popup For each discrepancy IntelliJ IDEA suggests a fix. To apply a suggestion, click the link next to the reported event.

Joomla Event Log

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 IntelliJ IDEA 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 IntelliJ IDEA, you can use the PHP_CodeSniffer tool, which detects coding standard issues, in combination with Joomla Coding Standards, which provides a set of Joomla-specific standards to PHP_CodeSniffer. This will ensure that your code is clean, consistent, and free of some common errors.

To get started, install PHP_CodeSniffer using any technique described in Install and configure PHP_CodeSniffer. Probably the easiest way is to install it with Composer.

Install PHP_CodeSniffer

  1. Inside composer.json, add the squizlabs/php_codesniffer dependency record to the require or require-dev section. Press Ctrl+Space to get code completion both for the package name and version.

  2. Do one of the following:

    • Click the Install shortcut link on top of the editor panel.

    • If the Non-installed Composer packages inspection is enabled, IntelliJ IDEA will highlight the declared dependencies that are not currently installed. Press Alt+Enter and select whether you want to install a specific dependency or all dependencies at once.

Next, install Joomla Coding Standards, which will provide Joomla-specific standards to PHP_CodeSniffer.

Install Joomla Coding Standards

  1. Inside composer.json, add the joomla/coding-standards dependency record to the require or require-dev section. Press Ctrl+Space to get code completion both for the package name and version.

  2. Do one of the following:

    • Click the Install shortcut link on top of the editor panel.

    • If the Non-installed Composer packages inspection is enabled, IntelliJ IDEA will highlight the declared dependencies that are not currently installed. Press Alt+Enter and select whether you want to install a specific dependency or all dependencies at once.

The Joomla Coding Standards package will be installed, and the corresponding Joomla standard will be selected for the PHP_CodeSniffer 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 Configure PHP_CodeSniffer as a IntelliJ IDEA inspection for details.

Last modified: 29 June 2020