Configure 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 dialog (Control+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 dialog (Control+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_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
Inside composer.json, add the
squizlabs/php_codesniffer
dependency record to therequire
orrequire-dev
key. Press Control+Space to get code completion for the package name and version.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, PhpStorm 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
Inside composer.json, add the
joomla/coding-standards
dependency record to therequire
orrequire-dev
key. Press Control+Space to get code completion for the package name and version.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, PhpStorm 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 page of the Settings dialog (Control+Alt+S). For more information, refer to Enable PHP_CodeSniffer as a PhpStorm inspection.