PHPStorm tips for power users
A selection of less-known-yet-powerful features of PHPStorm.
Every pane in PHPStorm has several modes and can be configured either by hand or via key bindings.
docked: makes a pane not overlap with other panes or the code screen.
pinned: automatically hides a pane when not pinned.
floating: makes the pane float.
windowed: makes the pane a full-blown window.
split: to allow multiple panes in one area.
Working with non-pinned panes will allow for a much cleaner editor view. Binding certain panes to a key combination will show them at will.
By default, PHPStorm will only auto-import namespaces if you're already in a namespaced file.
Auto imports can be configured to also work in normal PHP files
Settings > Editor > General > Auto Import.
You can change almost every template of auto-generated code in
Settings > Editor > File and Code Templates
For example: generate getters and setters without docblocks, generate test functions in another format and others.
alt + enter (
Show Intention Actions) on a string, you'll get multiple useful actions.
replace quotes to toggle between single- and double quotes,
split string to.. split the string, and more.
Two very useful commands:
Copy Pathsto copy the full path to the current file.
Copy Referenceto copy the relative project path and line number to the current file.
This "current file" can be the file you're editing, but could also be the selected file in the tree view or navigation bar.
Commands to toggle options
Instead of opening the settings to toggle options, there are a lot of toggles you can manage from the command palette. For example: show or hide the tabs bar.
You can open the command palette with
⌘ ⇧ A on the default Mac keymap.
If you want to lookup the keybinding on your system: the command is called
Custom JVM options
PHPStorm runs on Java, and there's a file in which you can specify extra options for the JVM to optimise performance. I've written about those options here.
Distraction free mode
Distraction free mode will hide all panes by default, but you can easily bring them back via the command palette or key bindings.
Besides this "no clutter by default", your code will also align more centered.
This can be a much more pleasant reading experience.
The width of this centered code view is configured in
Settings > Editor > Code Style > Hard wrap at.
This is where the ad would go. I get it, they are stupid. But to be honest, they actually make a difference. So maybe you'd consider whitelisting this blog?
Do you want to know why a word is highlighted or change it?
There's a command called
Jump to Colors and Fonts which will allow you to edit
the color of your current scheme, for that entry.
Any more suggestions?
I'd love to hear your own tips on how to use PHPStorm. Feel free to let me know via Twitter or e-mail.