PhpStorm 2024.3 Help

Phing

PhpStorm supports integration with the Phing build framework. Phing is mainly intended for building PHP projects, but it can also be used as a build tool in a number of areas. Phing functionality in PhpStorm is provided through a dedicated Phing Build tool window.

Enable Phing support in PhpStorm

Option 1: Enable Phing in the project settings

  1. In the Settings dialog (Ctrl+Alt+S) , go to PHP | Phing.

  2. In the Phing page that opens, specify the location of the phing.bat file in the Path to Phing executable field. Type the path manually or click Browse the Browse button and choose the file location in the dialog that opens.

Option 2: Enable Phing from the Phing Build tool window

  1. Open a Phing build file in the editor or select it in the Project tool window.

    A correct Phing build file is an xml file with the <project> root element.

  2. From the context menu of the editor or the selection, choose Add as Phing build file.

  3. In the Phing Build tool window that opens, click the Settings button the Properties button on the toolbar.

    The button is only available if the list of build files is not empty.

  4. In the Phing Settings dialog, that opens, specify the location of the phing.bat executable file.

Option 3: Enable Phing on the fly, when attempting to run a build file

  1. Open a Phing build file in the editor.

  2. From the context menu of the editor, choose Run Build File.

  3. In the Phing Build tool window that opens, click the Settings button the Properties button on the toolbar.

    The button is only available if the list of build files is not empty.

  4. In the Phing Settings dialog, that opens, specify the location of the phing.bat executable file.

Access Phing Build tool window

  1. Open a Phing build file in the editor or select it in the Project tool window, and then choose Add as Phing build file from the context menu of the selection.

  2. Choose View | Tool Windows | Phing Build from the main menu. The tool window can be accessed after you have opened it through the context menu of a Phing build file in the editor or in the Project tool window.

    Run builds

    1. Open the Phing Build tool window.

    2. Select the required build file in the list and click the Run button the Run button on the toolbar or choose Run Build from the context menu of the selection.

    Running separate build targets

    Do one of the following:

      Manage lists of build files

      A correct Phing build file is an xml file with the <project> root element. Build files are created outside the Phing Build tool window and are normally stored under your PHP project root folder. Find more about writing Phing build files in Phing Getting Started.

      To configure a list of build files, perform these general steps

      1. Open the Phing Build tool window.

      2. To add a build file to the list, click the Add button the Add button on the toolbar and choose the required xml build file in the Select Phing Build File dialog, that opens.

      3. To remove a build file from the list, select the file and click the Remove button the Remove button on the toolbar.

      4. To navigate to the source code of a build file, select the desired file and choose Jump to Source from the context menu of the selection.

      Customize build execution

      A Phing build file normally contains property elements that can be configured either manually in the build file itself or externally, in the Phing Build tool window. Properties that are configured externally are passed to Phing through a command line when build execution is launched, and therefore they are every time re-calculated dynamically. Externally configured properties always override the ones set manually in the build file.

      Configuring a property externally

      1. Open the Phing Build tool window.

      2. Select the required build file in the list and click the Settings button properties.gif on the toolbar.

      3. In the Phing Settings dialog that opens, switch to the Properties tab and configure a list or properties to be passed to Phing through a command line.

        1. To add a new property to the list, click the Add button.

        2. In the Property field, type the name of the property.

        3. In the Value field, specify the property value to be passed. Do one of the following:

          • Type the value manually.

          • To use PhpStorm macros, click the Insert macro button the Add button and configure a list of relevant macro definitions in the Macros dialog that opens. To add a macro, select it in the list and click Insert.

      4. When the list of properties is ready, click OK in the Phing Settings dialog.

      Manage Phing build targets

      Examining the build targets defined in a build file

      1. Open the Phing Build tool window. The window shows all the build files as nodes.

      2. Depending on your goal, do one of the following:

        • To view the build targets defined in a specific build file, expand the corresponding node by clicking plus_expand.png next to the build filename. Note that this expanding does not affect the targets marked as hidden.

        • To fold or unfold the build targets defined in all build files, click respectively the Expand All button the Expand All button or the Collapse All button the Collapse All button on the toolbar. Note that unfolding does not affect the targets marked as hidden.

        • To navigate to the definition of a target in the source code, select the desired target and choose Jump to Source from the context menu of the selection.

      Hiding targets

      Among the targets defined in a build file, you may have some that are only called by other targets and are never run alone. You can suppress showing such targets in the build file tree by marking them as hidden.

      Hidden targets do not become visible when you expand the node of a specific build file or click Expand All button the Expand All button.

      You can mark a target as hidden both directly from the Phing Build tool window or from the Phing Settings dialog. However, the hidden status can be removed only through the Phing Settings dialog.

      Depending on your goal, do one of the following:

      1. To mark one or several build targets as hidden, do one of the following:

        • In the Phing Build tool window, select the targets under their build file node and choose Mark to Hide from the context menu of the selection.

        • Select the build file in which they are defined and click the Settings Preferences button properties.gif on the toolbar. Then in the Phing Settings dialog that opens, switch to the Hiding targets tab and select the Hide checkboxes next to the targets to be hidden.

      2. To remove the hidden status of a target:

        1. Select the build file in which it is defined and click the Settings Preferences button the Properties button on the toolbar.

        2. In the Phing Settings dialog that opens, switch to the Hiding targets tab where the Hide checkboxes next to the names of the hidden targets are selected. Clear the Hide checkboxes next to the targets for which you want the status hidden removed.

      Associating a shortcut with a Phing target

      You can associate a build target with a keyboard shortcut and execute commonly-used targets with a single keystroke. If a Phing build file is added to the project, its targets appear under the Phing Targets node in the Keymap dialog.

      1. In the Phing Build tool window, right-click the desired build target.

      2. From the context menu, choose Assign Shortcut.

      3. In the Keymap dialog that opens, configure the shortcut as described in Keyboard shortcuts.

      Appointing targets for execution before running or debugging

      1. Open the Phing Build tool window.

      2. Select the desired target and choose Before Run/Debug from the context menu of the selection.

      3. In the Execute Target Before Run/Debug dialog that opens, select the configurations before which you want the target executed.

      Last modified: 29 July 2024