Joomla!
Use PhpStorm as an IDE for Joomla! development.
Enable Joomla! support in PhpStorm
Option 1: Enable Joomla! support in PhpStorm settings
Open
(Ctrl+Alt+S) .Extend the Enable Joomla! integration checkbox, and specify the parameters as follows:
node, select theJoomla! 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.
Option 2: Create a new PhpStorm project from a Joomla! template
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 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.
Option 3: Import an existing Joomla! project
When you 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.Click Enable Support to open the modal dialog and specify the parameters.
Install Joomla DocBlock templates
When PhpStorm recognizes the Joomla! project structure, it suggets installing Joomla DocBlocks standards for PHP files, classes, class properties, and so on.
Set up Joomla! code style in a PhpStorm project
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.
Change code style settings manually
You can also set the predefined code style manually on the Code Style: PHP page.
In the Settings dialog (Ctrl+Alt+S) , navigate to .
Click Set from and choose Joomla! from the drop-down list that opens.
Detect databases in Joomla! projects
PhpStorm detects databases in projects. Click in the Database tool window tool window and choose 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 (Ctrl+Alt+S) .
Check 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. To get code completion for the package name and version, press Ctrl+Space.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. To get code completion for the package name and version, press Ctrl+Space.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 (Ctrl+Alt+S) . For more information, refer to Enable PHP_CodeSniffer as a PhpStorm inspection.