Skip to content

Latest commit

 

History

History
102 lines (71 loc) · 5.02 KB

phpstorm.md

File metadata and controls

102 lines (71 loc) · 5.02 KB

IDE JetBrains PhpStorm

This document describing how you can configure your IDE PhpStorm.

Configuring PhpStorm

General

  • Go to Settings -> Plugins and install next plugins:
    • .env files support
    • .ignore
    • Makefile Language
    • Php Annotations
    • Php Inspections (EA Extended)
    • Php Toolbox
    • Symfony support (Has some paid functions, homepage)
    • Rainbow brackets
    • String Manipulation
    • Extra ToolWindow Colorful Icons
  • Go to Settings -> Php -> Symfony and check Enable plugin for this project and set Web Directory value as public.
  • If you want control quality of your PHP project - pay your attention to the tools, described here.

CLI Interpreter

You need to set correct CLI interpreter for your PhpStorm. In order to do it please open Settings -> PHP section and follow recommendations configuring remote PHP interpreters.

Path mappings Path mappings

Composer

Go to Settings -> Php -> Composer and set path to composer.json, check other settings:

Path mappings

Server

In order to configure PHP servers please open Settings -> PHP -> Servers. You need to configure how your local files will be mapped inside docker container:

Path mappings

Test Frameworks

If you want to run tests directly from your IDE you need to do following configuration in Settings -> PHP -> Test Frameworks:

Path mappings

Next you need to add Run/Debug configuration for PHP Remote Debug. It needs to be the same as image below:

Path mappings

Debugging

In order to use Xdebug as debugging tool please follow Using Xdebug documentation.

Code Style

This environment has committed .idea/ catalog, so most IDE configs should be available out of the box. But if you want to have own configs, you can put ./idea in gitignore and delete folder from the git repository. Anyway you can always import our recommended code style if you don't have committed ./idea folder inside your repository:

  • Go to Settings -> Editor -> Code Style -> PHP and import scheme Project (CodeStyle.xml) from docs/phpstorm:

Path mappings

PHP Inspections and code quality tools

  • Go to Settings -> PHP -> Quality tools and configure next:

Path mappings Path mappings Path mappings Path mappings Path mappings

  • Set other configurations for code quality tools and make sure that you have proper path for the MessDetector ruleset phpmd_ruleset.xml:

Path mappings Path mappings

  • If you don't have committed folder .idea/, go to Settings -> Editor -> Inspections and import profile Project Default (Inspections.xml) from docs/phpstorm:

Path mappings

  • Go to Settings -> Tools -> External tools and create ecs tool:

Path mappings

Note: Arguments value should be exec-bash cmd="./vendor/bin/ecs --clear-cache check $FilePathRelativeToProjectRoot$".

Note: In order to use it - right click on the necessary file/folder in PhpStorm and select context menu External Tools -> ecs.

  • Go to Settings -> Tools -> External tools and create phpcs tool:

Path mappings

Note: Arguments value should be exec-bash cmd="./vendor/bin/phpcs --version && ./vendor/bin/phpcs --standard=PSR12 --colors -p $FilePathRelativeToProjectRoot$".

Note: In order to use it - right click on the necessary file/folder in PhpStorm and select context menu External Tools -> phpcs.

For inspecting your code you can use main menu item Code -> Inspect Code. Code will be processed by code quality tools like PHP CS Fixer, PHP Mess Detector, PHP CodeSniffer, PHPStan.

External documentations