By Bruno Skvorc

PhpStorm – Top Productivity Hacks and Shortcuts

By Bruno Skvorc

We all have our favorite IDEs/editors when coding. Mine is PhpStorm, and it took a while to master all its shortcuts and establish a rapid workflow. In this article, I’ll share some keyboard shortcuts and tips with you which you should make part of your regular routine if you, too, do your work in this IDE. This article was partially inspired by this Reddit thread, and will be mentioning and demonstrating some of the shortcuts found there as well.

Note that as I’m doing my development on Linux in a vagrant box hosted on Windows, my shortcuts might be different from yours. The JetBrains reference card matches them up perfectly and gives you the OS X alternatives: Reference Card.

Keyboard shortcuts and hacks

PhpStorm’s high configurability (it’s almost an “Android” of the PHP IDE world) lets you fine tune it to infinity – you can make it into a tool so personal, it might seem like a different IDE to anyone opening your settings. Let’s see some shortcuts and hacks we can take advantage of:

  • CTRL + ALT + L, one of my most used keyboard combos, will immediately format your code according to the preferred style guidelines:

    What’s more, as you can see by the popup that appears in the animation above, you can choose to reformat your entire project. If you use this excessively and don’t often work on other people’s projects, you take it up another notch – bind a macro to the CTRL+S shortcut, and make PhpStorm automatically reformat your code on every manual save. Note, however, that if you’re working on a project with someone else, this might cause refactors in various files far too often, and pollute your version control system with changes that aren’t changes at all. If you’re on Linux, your CTRL+ALT+L shortcut might already be bound to “Lock Screen”, and you’ll need to unbind it from the system, or change it in PhpStorm’s settings.

  • Pressing CTRL+SHIFT+Backspace, or the “Forward” and “Back” buttons on your mouse if you have them, will walk you through your previous edit locations. This is very useful when dealing with large files and having to reference another part only to come back to the original to continue the work:

  • Holding down CTRL when hovering over variables or methods will give you their full names or locations of declaration, while CTRL+Clicking on a variable or method, or pressing CTRL+B when on a method’s call or on a variable will take you directly to where it’s defined:

  • CTRL+Space will summon a code hinting dialog, if you accidentally closed it or for some reason it didn’t open:

  • When PhpStorm detects some problems, it will underline the problematic area and summon a lightblub on top of it when you hover your mouse or keyboard cursor in that area. Clicking this light bulb or pressing ALT+Enter will suggest solutions – in any language. This can range from turning off error reports for suppressed notices (something I recommend against), to merging CSS rules:

  • CTRL+N and CTRL+SHIFT+N will let you instantly move to any part of any class or file in your entire project:

    The search is fuzzy, and also supports line numbers – you can use abbreviations followed by :XX where XX is the line number:

  • PhpStorm remembers multiple clipboard contents – you can press CTRL+SHIFT+V to summon a popup which lets you paste clipboard content that’s less recent than the latest.

  • If you’re in love with Sublime’s ability to search for commands of the IDE itself, you can do that too. CTRL+SHIFT+A will spawn a command search popup. Forgot how the code reformat shortcut goes? Just CTRL+SHIFT+A and type “refor..”:

  • Generate full HTML without writing it out, using Emmet, built into PhpStorm. Typing div#myDiv>span.mySpanClass>ul>li*5 and hitting tab will turn into:

    Further extend this in any language of your choice by adding your own expandable templates into the Settings -> Editor -> Live Templates dialog. You can choose where to position your cursor, add variables, and much more. The full Emmet cheat sheet for CSS and HTML can be found here.

  • Perhaps somewhat counter-intuitively, CTRL+W (which is most often used for closing tabs, so you may want to remap it) will select a “unit” of code under your cursor (a word, a variable, etc). Repeating the combination then expands the selection to include the parent node – all the way to the entire file (e.g. function call -> instance and function call -> row -> entire row -> method -> containing class…):

  • Context-aware editing will allow you to edit a string that’s written in another language in a dedicated editor, complete with code hinting and autocompletion. For example, you if you have an HTML snippet written in a PHP string, you can ALT+ENTER in the string’s content and select Edit HTML content. This happens:

  • Column selection mode can be summoned by holding the middle mouse button down and dragging over a piece of code. I’ve found this especially useful when I need to paste a deeply indented part of my code, but don’t want the preceding whitespace copied as well:

  • Pressing ALT+Home will let you use your cursors to move through the breadcrumb navigation at the top. ESC escapes this mode and returns you to the editor, unless you make a file selection in the breadcrumbs – then the file is immediately in focus.

  • Refactoring (renaming) variables and applying the change to all locations that use it is as easy as selecting right-click -> refactor, pressing SHIFT+F6 or even pressing SHIFT+ALT+CTRL+T to summon the entire refactor menu as shown in the animation below:

  • CTRL+F12 will summon a popup that lets you select a method in the current file to which you want to jump. Even though there’s no search field, if you just start typing you can narrow the selection down to exactly what you’re looking for.

  • As described in this tweet, you can now “search everywhere” by double-tapping Shift. This is like a powerful blend of all previous search shortcuts, allowing you to find anything you need in any part of the project or IDE – from IDE commands to classes and function declarations and more.


PhpStorm has a wealth of various language plugins. I, for one, make heavy use of the Dart plugin for PhpStorm. This isn’t the type of plugin I’d like to talk about, though – there’s a plethora of productivity plugins, too. Plugins adding features you never thought a PHP IDE might have:

  • The combination of DynamicReturnType plugin with a good dependency injector, as described by Danack, will let you do proper IoC and still keep all your autocompletion and code inspection as if dealing with the classes directly. A more detailed article on using this particular combination will be published soon.

  • The key promoter plugin shows you the keyboard shortcut to your mouse actions as you perform them. If you use certain actions a lot, and they don’t have a keyboard shortcut, it will ask you if you’d like to add it.

  • CSS-X-Fire allows you to edit your CSS in Chrome’s Firebug lite, or Firefox’s Firebug, and on switching back to PhpStorm, you’ll be asked if you’d like to apply the changes you made in the browser to the CSS in your project’s code.

  • You might know that PhpStorm is a project-based IDE, meaning it cannot open and edit arbitrary non-project files like a regular text editor. This can be awkward when you need to brainstorm something or just write some notes for yourself but don’t want to pollute your project’s folder. Scratch lets you use temporary files in your projects for that exact purpose.


Dark themes for readability

Many people underestimate a good theme, dismissing it outright as flair or pure vanity. This is wrong – a good theme is a good user experience – it increases readability and makes you notice errors, keywords and all the syntax spice intuitively, without having to think about it. There are several benefits to using dark themes:

  • when looking at a bright display, your eyes get fatigued faster, especially at night (which is when most programmers tend to do their work). On dark displays, instead of focusing on the entire bright screen and trying to discern holes in it (darkness – letters), your eyes are immediately drawn to the bright parts – the text, ignoring the background altogether.
  • I subjectively claim that colors are easier to notice when on darker backgrounds. Naturally, this means the colors should have a decent, but not too strong contrast to the background
  • It’s a known fact that blue light from self-lit displays suppresses melatonin, which in turn disrupts your sleep patterns. If you find yourself having difficulty falling asleep after a 4AM coding session despite feeling utterly obliterated by fatigue, try a darker theme and exposing yourself to less light in general when working at night.

Things to look for in a theme are mid-range contrasts. Avoid absolutes – the background shouldn’t be pure black, and the text shouldn’t be pure white/red/green/orange. These sharp contrasts confuse and strain the eye just as much as having an all-white background and all-dark text does. Instead, look for pastel, smokey colors. Likewise, increasing the font is usually a good idea, if the theme’s default is tiny. The eyes strain when reading too small letters, and if the spacing isn’t good enough either, you’ll have a hard time reading anything without welcoming a headache. Two of my suggestions for darker themes are Darcula, which comes built into PhpStorm, and Solarized.

Apart from the generally more pleasant color scheme in Darcula (shown above), I’m the type of developer who uses comments extensively in my projects, so having them more legible but still not distracting is a valuable perk. The project structure is also, in my opinion, far more readable in the second screenshot – the light blue vs. gray contrast seems optimal to my eye.

While most theme preference discussions are, admittedly, subjective, I encourage you to venture outside your eyes’ comfort zone for a day or two and give alternatives a go. You’d be surprised at how fast you can adapt to the new style if you find one that particularly matches you.


In this article, we covered and demonstrated some popular and/or extremely useful keyboard shortcuts and productivity hacks for PhpStorm – an IDE that’s far more customizable than one might assume at first glance. What are your tips and productivity hacks? Do you see any missing? Let us know in the comments below and we’ll add them!

  • Nguyen Tuan

    great and useful!

  • tunepk

    What about multi-select? We all love Multiselect in SublimeText..please?

  • Ariel Bluman

    Inject HTML in pycharm (3.1) breaks if i use multiline htmls =

    there is shortcut for scrolling through suggestions?
    for example:
    use -> -> User -> -> UseSomthing

    • Not sure I understand the question? You have problems with Emmet?

  • Guest


  • Trakun Zen Onrat

    +1 ^___^

  • Chí Thanh Nguyễn

    thank you so much for your post ^^

  • Fantastic, thanks! I totally love the way PHPStorm’s creators have built PHPStorm (and their other IDEs btw): Everything is clever, intuitive, well-thought, easy to use, full of little details, optimized for speed and workflow. I would have bought it for the git handling alone, but there’s so much more … If you never tried PHPStorm, then give it a try, it will change your workflow dramatically.

  • You can also change tab using Control + PageUp (previous tab) or Control + PageDown (next tab). I discover it simpler to use than Ctrl+Tab since it doesn’t stress the fingertips on one side, at least on a laptop

  • Vincent Clair

    I have used many IDEs on Mac : Eclipse / Aptana Studio / Zend Studio, NetBeans or phpDesigner (and not so IDE as Coda or RapidWeaver). PHPStorm is far the more suited for me, really usefull and well designed.

  • Brought tears to my eyes.

  • kiwi

    Can we have the same shortcuts on mac ?

    • “Note that as I’m doing my development on Linux in a vagrant box hosted on Windows, I’ll be using CTRL instead of CMD. If you’re on OS X, just imagine it says CMD.”

      If they’re not the same when you replace CTRL with CMD, just open the command browser (CMD+SHIFT+A) or the “search everywhere” popup (double Shift) and search for the command by name – you’ll see the keyboard shortcut there too.

  • You’re welcome!

  • Aleksandar Ristić

    CTRL + ALT + L is for locking the screen on KUBUNTU, can’t use it for PHPStorm :) I’ve started using this IDE 5-6 months ago, it’s great!

    • Like I say in the article “If you’re on Linux, your CTRL+ALT+L shortcut might already be bound to “Lock Screen”, and you’ll need to unbind it from the system, or change it in PhpStorm’s settings.”

  • Tobias Hochgürtel

    I suggest, great and useful article. I created some notes on my desk.

  • mbaroz

    Great tips!
    I love this IDE. but I need it to support FTP editing without downloading the while FTP files. Any idea? Or plugin?

  • Miles Johnson

    Love PHPStorm. I even ported the dark TomorrowTheme to it if anyone is interested.

  • Huỳnh Minh Tú

    It runs so slowly on my Laptop, 4gb of ram

  • saeba

    Hello, I have a small problem with shortcuts in last PhpStorm. I’m on Linuxmint 16 and shortcuts Alt+Number (like Alt + 6 for todo list) doesn’t work. All other shortcuts without Alt key work perfectly :( Can someone help me ? Thanks

  • Elfet

    Look at my theme for PhpStrom:

  • It’s not just about the RAM, PhpStorm is very disk intensive – it works hard to index everything and provide super fast code hints. On my SSD, it runs everything instantly and loads up fully in 3-4 seconds.

  • miron

    Hey Bruno, great article, thanks for sharing!

    I’m using phpStorm on mac os and it seems that only one shortcut (as far as i know) is different mapped as the others. If I want to jump to a class in my project on mac os i’ve to press CMD+O order CMD+SHIF+O to jump to the specified file.

  • Thanks for the heads up!

  • mbadolato

    For a darker theme, we have one that’s based on the online docs for Symfony2 and Doctrine:

  • Gareth Davies

    Nice article. I’ve found a printed version of the official reference card a handy resource too

  • Jose Ruzafa

    very good article thanks for sharing, it has served me well since I use your advice much php.

  • brtsos

    Cool !

  • Srinivas J R

    Thanks for that useful tips.

    Could you care to explain how to increase the font size of list of files in Project Navigator on the left sidebar.

    In the IDE settings > Appearence > when I Check “override default fonts by (not recommended) ” and selected any font with increased font size, then font size of the files list in Project Navigator overlaps with one other vertically. I see in your screenshots u have clear fonts with good font size, any help? I’m on Win 8.1

    Check these screenshots for reference

  • Not sure. Which PhpStorm do you have? Anyway, here, have my settings, maybe they’ll help, I’m on Win8.1 too:

    • Srinivas J R

      Thank you again. I’ve used your settings, still no improvement. Anyway I’ve PhpStorm 7.1.2, I’ll try from PhpStorm support.
      Wonderful post and will definitely improve my usage of PhpStorm.

  • John Bertucci

    Great article. I also use the plugin CodeGlance. to get that very zoomed out view of your file. And I moved my file “tabs” to go vertical instead of horizontal since I end up with so many files open with big file names. That was just a change in the IDE settings.

    • Excellent plugin and a good point about the vertical tab names, thanks

  • Sebastien Barre

    Great writeup! I’m a long-time PhpStorm user and I learned a bunch of stuff here.

    For your comment about blue light affecting sleep patterns when working at night, you should check out f.lux at it’s a great little tool that changes your monitor’s colour range to a warmer tone as the sun goes down and makes it much easier on your eyes.

    This little tool has vastly improved my nighttime coding.

    • Whoa, that’s a fantastic tool. Trying it out this very weekend, thanks!

  • Codrut Bila

    how would you rate html5 buider [ embarcadero ] vs phpstorm? thks.

    • You probably mean RAD studio, which includes the Html builder. I haven’t tried it, so I don’t know, but any software that isn’t available on all OS is a dead start from me.

  • That is wonderful! Thanks a lot for this description. Quite useful!

  • Bionik6

    Nice article, see nothing new for me here because I spend a lot of time configuring my IDE. Think for many years that nothing was best than Netbeans when it comes to develop but when I’ve switched to PHPStorm, I’ve really seen the difference, very customizable, many features and so on….
    Wonder they fully integrate Laravel in the next versions of the IDE :)

  • I don’t really know why but whenever I try to increase the font size (for the editor) to 14, all lines become “funky” with some sort of unaligned. I’m on a Mac, with latest 7.1.2 version of PhpStorm. Does anybody get this problem?

    Another big problem for me is as soon as I start the app, it eats up approximately 500MB of memory. I know it’s an IDE, and Java-based, so it’s understandable, but I really want something more light-weight.

  • CTRL + SHIFT + F in Mac will allow you to find text under a path or the whole project & CMD + SHIFT + UP/DOWN keys allows you to move selected lines up or down.

Get the latest in PHP, once a week, for free.