PhpStorm 2016.3 Help

Enabling PHP Support in a Project

In this section:

Creating an empty PHP project

  1. Choose File | New Project on the main menu or click the New Project button on the Welcome screen. The New Project Dialog dialog box opens.
  2. In the left-hand pane, choose PHP Empty Project.
  3. In the right-hand pane:
    • In the Location text box, specify the path to the project folder where the project-related files will be stored.
    • In the PHP Language Level drop-down list, specify the PHP functionality scope to get coding assistance for. Each functionality scope is associated with PHP version that supports this functionality. Currently PHP 5.3, PHP 5.4, PHP 5.5, PHP 5.6, PHP 7, and PHP 7.1 levels are supported.

      No correlation between the PHP version used in the project and the language level is enforced. Although the language version of each interpreter is detected automatically, you can still tell PhpStorm to provide you with coding assistance that corresponds to another language level. However, if you attempt to use a code construct that is not supported by the specified language level, PhpStorm suggests a Switch to PHP <version> quick-fix.

    • From the CLI Interpreter drop-down list, choose the PHP interpreter to use in the current project. The list contains all the currently configured local and remote PHP interpreters. See Configuring Local PHP Interpreters and Configuring Remote PHP Interpreters for details.
    • The Include Path area shows a list of paths to PHP-related items below the PHP home directory. The specified include paths will be used:
      • By the require(), include(), fopen(), file(), readfile(), and file_get_contents() functions when looking for files to use.
      • By PhpStorm when resolving references to included files.

      Use the Add new.png  and Remove  delete.png buttons to manage the contents of the list. Use the Up /help/img/idea/2016.3/arrowUp.png  and Down  /help/img/idea/2016.3/arrowDown.png  buttons to change the order of items in the list.

    When you click Create, PhpStorm generates a project stub and opens it either in the current window or in a new one depending on your choice in the information dialog box that opens:
    /help/img/idea/2016.3/ps_openProjectInNewFrame.png
    Refer to the section Opening Multiple Projects for details.

See also Configuring PHP Namespaces in a Project

Creating a PHP project from existing sources

Besides creating an empty PHP project, you can re-use your previously developed sources.

Choosing the PHP interpreter and the language level manually

To start PHP development in a project, you need to appoint one of the previously configured local or remote PHP interpreters to use and choose the PHP language level which determines the scope of PHP functionality to get coding assistance for. Currently PHP 5.3, PHP 5.4, PHP 5.5, PHP 5.6, PHP 7, and PHP 7.1 levels are supported.

To use PHP-related items from outside your project content root, configure include paths as described in Configuring Include Paths.

If you created your project through the New Project dialog, you have already specified the language level and possibly the interpreter and the include paths. However, if your project was created around some existing sources, you need to specify these settings manually.

  1. Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or PhpStorm | Preferences for OS X, and click PHP under Languages&Frameworks. Open the PHP page: choose File | Settings and in the Settings dialog box that opens, click PHP under Languages & Frameworks.
  2. In the PHP page that opens, choose the PHP installation to use from the CLI Interpreter drop-down list.
    • To make sure that the configuration you have chosen points at the relevant installation, click the Reload button refresh.png  next to the drop-down list. If no PHP engine is actually installed at the specified directory, PhpStorm displays the corresponding error message.
    • Click the Show phpinfo button to have PhpStorm display a separate information window where you can examine the installation details and view the list of loaded extension and configured options. Please note that the options specified in the Configuration Options field of the CLI Interpreters dialog box are not listed.
  3. In the PHP language level drop-down list, specify the PHP functionality scope to get coding assistance for. Each functionality scope is associated with PHP version that supports this functionality. Currently PHP 5.3, PHP 5.4, PHP 5.5, PHP 5.6, PHP 7, and PHP 7.1 levels are supported.

    No correlation between the PHP version used in the project and the language level is enforced. Although the language version of each interpreter is detected automatically, you can still tell PhpStorm to provide you with coding assistance that corresponds to another language level. However, if you attempt to use a code construct that is not supported by the specified language level, PhpStorm suggests a Switch to PHP <version> quick-fix.

See Also

Last modified: 23 March 2017