DEV Community

Daniel Werner
Daniel Werner

Posted on • Originally published at on

My favorite PhpStorm features and keyboard shortcuts

Working as a software developer in the past 10+ years, I’ve used couple of IDEs and text editors (e.g Eclipse, Netbeans, Sublime text, Notepad++, etc), but in my opinion the best one is PhpStorm. It has similar features as the other IDEs, but as opposed to the others, it just works. You don’t need to install fancy plugins, and it comes with reasonable default settings so no need to do a lot of configuration in the beginning (of course it has a plenty of configuration and customization options). Let’s see what are the features I like and use in my day to day work. The features described below should work on any operating system, but the keyboard shortcuts are for macOS.


+ click – Jump to definition, can be used on functions, methods, classnames, variables and constants. Very useful tool to navigate through the source code, it also works on vendor directory

+ [ – Navigate back to the previous position, can be used in combination with the previous feature: check a function by jumping to its definition and navigate back to the previous position afterwards

+ ] – Navigate forward: the opposite action to the previous

+ O – Search for classes, a handy feature to quickly open a desired class

⌘ + ⇧ + O – Search for files, similar to the previous one but it searches for the file name instead of class

⌘ + L – Jump to the given line in the current file


⌘ + / – Comment/uncomment the selected line(s)

⌘ + backspace – Delete the current line

⌘ + ⌥ + L – Reformat code, apply the rules of the configured coding standard for the currently open file

⌘ + N – Generate: can be used to generate class constructor, getters and setters. Simply add the necessary properties to the class, press the key combination choose the properties to initialize in the constructor and PhpStorm will generate the constructor with all the necessary arguments and set the properties accordingly.

File creation

From the New… context menu you can create Classes, Interfaces and Traits, and it will create the boilerplate code for you according to the name and configuration you set in the dialog.

Another useful feature is to create PHPUnit test. In the dialog you can choose the class and also the methods for testing, and the IDE will generate all the test cases for the selected methods.


F8 – Step over the next function/method call

F7 – Step into the function/method call

⌘ + ⇧+ R – Run the debugger after it has stopped at a breakpoint


⌘ + ⌥ + M – Extract method, I’ve recently heard of it and it works very well. Just select a part of the code to extract as a method, and it will create the method with all the necessary arguments.


Regarding the copy paste PhpStorm has a cool and a really annoying feature. The cool feature is the Paste History: ⌘ + ⇧ + V – opens a dialog to choose from the recently copied items.

The most annoying feature in the PhpStorm is that by default it allows you to copy nothing , e.g. if nothing is selected and you press the ⌘ + C , it will simply delete the content of the clipboard. It happened a lot that I’ve copied something and when tried to paste it I’ve pressed the ⌘ + C instead of ⌘ + V and I had to copy it again. It is especially problematic if you’ve cut something, you need to undo the cut to be able to copy it again (or use the paste history).

Fortunately you can disable this behavior:

Invoke Help | Find Action… (Ctrl (Cmd on Mac)+Shift+A), type Registry and select the Registry… item that appears. Enable the editor.skip.copy.and.cut.for.empty.selection option there.

Credit for this solution goes to the author of the following stackoverflow answer:

Do you know some other great features of PhpStorm I haven’t mentioned here? Please share it in comments below.

The post My favorite PhpStorm features and keyboard shortcuts appeared first on 42 Coders.

Top comments (0)