JetBrains Fleet 1.13 Help

Getting started with PHP

This tutorial gets you up to speed with PHP development in JetBrains Fleet. It covers the installation, project setup, and working with code.

Prerequisites

JetBrains Toolbox 1.22.10970 or later: the Download page.

Installing software

Download and install PHP

  • Download and install PHP for your operating system as described in the official documentation.

    Alternatively, you can install a preconfigured operating system-specific AMP package such as XAMPP for Windows, LAMP for Linux distribution used, and MAMP for macOS.

Download and install Fleet

  1. Make sure you are logged in JetBrains Toolbox under your JetBrains Account.

  2. In JetBrains Toolbox, click Install near the JetBrains Fleet icon.

    Download and install Fleet

Set up a workspace

Workspace is the directory where your project resides. It contains the project files and settings. You can open an existing project or start a new project by opening an empty directory.

Open an existing workspace

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

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

  3. Proceed to the workspace configuration.

When you open a directory, it becomes the root of a workspace. You can view its contents in the Files view.

The Files view in the left panel

Workspace configuration

Configure settings for the workspace

To be able to run your code, you need to appoint a PHP interpreter to use inside JetBrains Fleet.

  1. In the Files view, right-click the workspace root folder, then select New Folder. Name it .fleet.

  2. Right-click the .fleet directory, then select New File ⌘N. Name the file settings.json.

  3. In the created settings.json file, provide the location of the PHP executable in the php.executable node.

    Path to PHP executable in Fleet settings

Enabling Smart Mode

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

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

    Enabling Smart Mode

Here's what you can do in Smart Mode. The below is not an exhaustive list of Smart Mode features, rather a couple of examples that'll help you to get the feel of how it works in Fleet.

Use quick-fixes and intention actions

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

    Intention actions popup
  • Navigate to the declaration of a symbol with ⌘B.

  • Use inlay hints navigate to usages and hierarchy members.

    Inlay hints in Fleet code editor
  • Skim over the errors with ⌘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

Use the run configuration

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

  2. In the run.json file, define running or debugging parameters. Alternatively, paste and edit the following code:

    { "configurations": [ { "type": "php", "name": "PHP", "environment": {}, "file": "index.php", } ] }
  3. Click the Run icon (⌘R) and select the configuration.

    Open an existing workspace
Last modified: 16 November 2022