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 popup For each discrepancy PhpStorm suggests a fix. To apply a suggestion, click the link next to the reported event.
Changing the Joomla! settings
Enable or disable Joomla! integration
In the Settings/Preferences dialog (Ctrl+Alt+S), navigate to . 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 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
From the context menu of composer.json, choose . Alternatively choose from the main menu.
-
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.
-
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 therequire-dev
section of the composer.json file instead of the defaultrequire
section. Click Install.
Next, install Joomla Coding Standards, which will provide Joomla-specific standards to PHP Code Sniffer.
Install Joomla Coding Standards
From the context menu of composer.json, choose . Alternatively choose from the main menu.
-
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.
-
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 therequire-dev
section of the composer.json file instead of the defaultrequire
section. 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 page of the Settings/Preferences dialog (Ctrl+Alt+S). See Configuring PHP Code Sniffer as a PhpStorm inspection for details.