JetBrains Fleet 1.48 Help

Getting started with PHP

This tutorial helps you get started with PHP development in JetBrains Fleet. It covers installation, project setup, and working with PHP code.

Prerequisites

Download and install JetBrains Toolbox

  • Download and install JetBrains Toolbox.

    For macOS, you can also download the installer that matches your processor type: Apple Silicon or Intel. Ensure you select the correct option based on your system's processor.

Download and install JetBrains Fleet

PHP environment

To run PHP code in JetBrains Fleet, you need to have PHP installed on your system. You can either install PHP manually or use a preconfigured package that includes PHP and other required components.

You can download and install PHP for your operating system by following the instructions in the official PHP documentation.

Alternatively, you can use a preconfigured AMP package based on your operating system: XAMPP for Windows, LAMP for Linux, or MAMP for macOS.

Set up a workspace

A workspace is the directory that contains your project. It includes both project files and settings. You can either open an existing project or start a new one by opening an empty directory.

Open a workspace

  1. Press ⌘ O or select File | Open from the main menu.

  2. In the file browser, navigate to the folder containing your code and click Open.

Workspace configuration

Usually the PHP interpreter is configured automatically. But you can always set the interpreter manually.

Configuring the PHP interpreter

  1. Press ⌘ , to open settings, then click the tab with the name of your workspace.

    Alternatively, to open settings, you can use the main menu:

    • Windows and Linux: click the Menu icon and navigate to File | Settings | Settings.

      workspace settings
    • macOS: from the main menu, click Fleet | Settings.

      workspace settings
  2. Navigate to Toolchains | PHP.

  3. From the Interpreter drop-down menu, select the PHP interpreter that you need.

    Selecting the PHP interpreter

Set PHP language level

  • There are two options available to set the PHP language level for Fleet:

    • Set the required PHP language level in your composer.json file. Fleet will automatically adjust language level inspections based on this setting. Add the following entry under the require section:

      { "require": { "php": "^8.3" } }
    • Create a /.fleet/settings.json file in your project and manually specify the PHP language level by adding the following setting:

      { "php.language.level": "8.3" }

Enabling Smart Mode

You can use JetBrains Fleet as a smart text editor, rather than a full-fledged code editor. However, if you need code intelligence features, you can enable them by turning Smart Mode on.

  • Click the Smart Mode Status icon in the top-right corner. In the popup that appears, click Enable.

    Enabling Smart Mode

JetBrains Fleet provides a variety of coding assistance features. Below are a few examples to help you get a sense of how they work in practice. This is not a complete list, but a good starting point for exploring what JetBrains Fleet can do.

Use quick-fixes and intention actions

  • Press ⌥ ⏎ to access actions that Fleet suggests in the current context.

    Intention actions popup
  • Navigate to a symbol’s declaration by pressing ⌘ B.

  • Use code interlines to navigate to usages and hierarchy members.

    Code interlines in Fleet code editor
  • Navigate between errors using ⌘ E and ⌘ ⇧ E.

Use live templates

  • To generate a for loop, type forek and press . Press as you fill in the necessary variables.

    Live Templates in Fleet code editor

Running your code

With Smart Mode enabled and a configured PHP interpreter, you can run your project.

A run configuration defines the parameters for running your application. It can include commands, executable paths, environment variables, arguments, and other required context.

Creating run configurations

  1. Click the Run icon (⌘ R) and select Create Run Configurations in run.json.

  2. In the run.json file that opens, define running or debugging parameters. If the file is empty, press ⌥ ⏎ or click the file template link.

    Alternatively, paste and edit the following code:

    { "configurations": [ { "type": "php", "name": "PHP configuration", "file": "./src/average_finder.php", } ] }

    Modify the configuration properties according to your environment.

    For more information about PHP run configurations in JetBrains Fleet, refer to PHP run configurations.

  3. Press ⌘ R or select Run | Run & Debug from the main menu. Select the configuration you want to run or debug.

19 May 2025