Blog

Setting up data source using the Joomla configuration

Setting up a data source is a very simple process when PhpStorm knows where to find your Joomla configuration as explained in the PhpStorm and the Joomla! configuration file blog. PhpStorm will read the database connection details from the Joomla configuration file and create the data source.

To create a data source we first need to open the database tool window. Usually the Database window is located on the left or right sidebar. In case the Database window is not shown on the sidebar, there are several ways of achieving this.

Opening the Database window using the menu

Open Database Window

  1. Click on View
  2. Select Tool Windows
  3. Click on Database
  4. The Database window will open up on the right sidebar

Opening the Database window using Find Action...

Find Action Window

  1. Hit CTRL-SHIFT-A / CMD-SHIFT-A to open the Find Action window
  2. Type Database
  3. Hit Enter or double click on the first Database
  4. The Database window will open up on the right sidebar

Creating a Data Source

To create a Data Souce we will follow these steps:

  1. Click on the + symbol to open the menu
  2. Select the Import from sources... option
    Import from sources
  3. PhpStorm will open the Data Source and Drivers page
  4. On the General tab all details are filled in with the settings from the Joomla Configuration file
  5. Give the Data source a name, this is by default filled with joomla.datasource
  6. Click on Test Connection to see if all details are correct
  7. Click OK to save the data source
  8. The Database window now has the database setup
    Joomla Data Source

You now have access to your database directly from PhpStorm.