Joomla!
Use PhpStorm as an IDE for Joomla! development.
tip
This guide assumes that you already have Joomla! downloaded and installed. For instructions about downloading and installing Joomla!, refer to the official Joomla! documentation.
Open Settings (CtrlAlt0S) | PHP | Frameworks.
Extend the Joomla! node, select the Enable Joomla! integration checkbox, and specify the parameters as follows:
Joomla! installation path
Specify the path to the root directory that contains the installed Joomla! core.
Path to JConfig
Specify the path to the
configuration.php
file containing the definition of Joomla'sJConfig
class.Click Apply to save the changes.
You can create a new Joomla! project in PhpStorm from a Joomla! integration template.
PhpStorm creates a stub Joomla! project that contains a PHP class <project name>.php and <project name>.xml manifest file. For more information, refer to www.joomla.org.
Open the New Project dialog by choosing File | New Project in the main menu or clicking Create New Project on the PhpStorm Welcome screen.
In the left-hand pane, select Joomla! integration.
In the right-hand pane, specify the Joomla! support parameters. In the Project type field, select one of the Joomla! project types (component, module or plugin) from the list.
When you open (File | Open in the main menu) a Joomla! module, plugin, or extension or the Joomla! core directory in PhpStorm, the IDE recognizes the Joomla!-specific project structure and suggests activating Joomla! support.
![Joomla project structure detected Joomla project structure detected](https://resources.jetbrains.com/help/img/idea/2024.3/joomlaStructure.png)
Click Enable Support to open the modal dialog and specify the parameters.
When PhpStorm recognizes the Joomla! project structure, it suggets installing Joomla DocBlocks standards for PHP files, classes, class properties, and so on.
![Joomla DocBlocks installation notification Joomla DocBlocks installation notification](https://resources.jetbrains.com/help/img/idea/2024.3/JoomlaDocBlocks.png)
If PhpStorm recognizes the project to be a Joomla! module, plugin, or extension, it automatically suggests applying the pre-configured Joomla! code style for this project.
![Enable Joomla! style formatting Enable Joomla! style formatting](https://resources.jetbrains.com/help/img/idea/2024.3/enable_joomla_style_formatting.png)
You can also set the predefined code style manually on the Code Style: PHP page.
In the Settings dialog (CtrlAlt0S) , navigate to Editor | Code Style | PHP.
Click Set from and choose Joomla! from the drop-down list that opens.
PhpStorm detects databases in projects. Click in the Database tool window tool window and select Import Data Sources. The settings specified in the file configuration.php are detected and used for the new data source connection.
PhpStorm provides database prefixes support and changes #__
to the prefix that is defined in the $dbprefix
field in the configuration.php file.
Additionally, PhpStorm detects the SQL dialect matching your database type and displays a notification prompting you to either set the detected default dialect automatically or to configure it manually on the SQL Dialects page of the Settings dialog (CtrlAlt0S) .
![Default SQL dialect notification Default SQL dialect notification](https://resources.jetbrains.com/help/img/idea/2024.3/set_detected_database_dialect.png)
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.
Inside composer.json, add the
squizlabs/php_codesniffer
dependency record to therequire
orrequire-dev
key. To get code completion for the package name and version, press CtrlSpace.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 AltEnter 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.
Inside composer.json, add the
joomla/coding-standards
dependency record to therequire
orrequire-dev
key. To get code completion for the package name and version, press CtrlSpace.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 AltEnter 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 dialog (CtrlAlt0S) . For more information, refer to Enable PHP_CodeSniffer as a PhpStorm inspection.
Thanks for your feedback!