Skip to content

3. Getting set up (PhpStorm)

Oleg Kuzava edited this page Jan 10, 2020 · 4 revisions

Configure Docker in PhpStorm

Docker is configured at File -> Settings -> Build, Execution, Deployment -> Docker. Click the green ➕ and add these details:

For Linux:

  • Name: Docker
  • Connect to Docker daemon with: Unix socket

For MacOS:

  • Name: Docker
  • Connect to Docker daemon with: Docker for Mac or Docker Machine (if you have VirtualBox installation)

Configure PHP

  • PHP is configured at File -> Settings -> Languages & Frameworks -> PHP
  • The PHP language level should be set to the recommended version 7.2
  • Click the 3 dots on the right side (CLI Interpreter) to open up the CLI Interpreters dialog. On that screen click the green ➕ and select From Docker, Vagrant, VM, Remote...:
    • Remote: Docker
    • Server: Docker
    • Image name: docksal/cli:php7.2
    • PHP interpreter path: php
  • Leave the Visible only for this project unchecked
  • Here is example of configured CLI:

CLI

Configure Xdebug

  • Set XDEBUG_ENABLED=1 in .docksal/docksal-local.env in your project
  • Apply container configuration with fin project start (fin p start)
  • Xdebug is configured at File -> Settings -> Languages & Frameworks -> PHP -> Debug
  • Here is example of configured Xdebug:

Xdebug

  • Under Preferences > Languages & Frameworks > PHP > Servers add a new server
  • Set Name and Host to project's virtual host (e.g. d8.docksal)
  • Map the project directory on the host to /var/www on the server
  • Here is example of configured Servers:

Servers

Configure Code Sniffer

  • Code Sniffer is configured at File -> Settings -> Languages & Frameworks -> PHP -> Quality Tools -> Code Sniffer
  • Click the 3 dots on the right side (Deployment environment) to open up the Code Sniffer dialog. On that screen click the green ➕ and select docksal/cli:php7.2 as Interpreter
  • Here is example of configured Code Sniffer:

CodeSniffer

  • Make sure you have enabled PHP Code Sniffer Validation at File -> Settings -> Editor -> Inspections:

Inspections

🎉 🎉 🎉 Congratulations! You are ready! 🎉 🎉 🎉