In this article, we’ll talk about the benefits of using labels in our daily work. A shortcut is a combination of a key or keys on the keyboard to execute a specific command that is intended to be done in several steps. When that combination of keys is done, for instance, if we want to copy the selected text faster, we can press Ctrl and C. Do you see? Using shortcuts saves us time and increases the possibilities of actions performed using the keyboard.
What is PhpStorm?
Software development is an art in the IT world, and a software developer is an artist in that. Just like every artist, a programer needs a tool to create their masterpiece. It’s an integrated development environment (IDE). There are many of them, but one of the most popular and robust is PhpStorm. It’s a perfect development tool for all PHP developers, adapted for most popular PHP frameworks such as Laravel, Drupal, Symfony, etc. It supports all the features of the PHP language for modern and legacy projects. Despite PHP, this tool includes support for front-end technologies such as HTML 5, CSS, Sass, JS, TypeScript, etc.
PhpStorm keyboard shortcuts
PhpStorm takes care of the programer code efficiency and provides a convenient environment to make development faster. One of the ways to achieve that is using shortcuts. We’ll take a look at the five most common shortcuts.
Alt + Enter shortcut
This is a universal context helper. It displays a context menu with available actions depending on where the cursor is. Here is the list of actions offered by the shortcut:
- importing the class under the cursor into the use section,
- updating the comment block by the method signature,
- adding interface methods that are required to implement.
As we can see, this shortcut indeed makes our development process easier and faster, as we don’t need to write much by ourselves.
Search everywhere shortcut
By double-clicking the Shift key, a pop-up window appears that allows us to search for any file, class, class method, property, or settings anywhere. It’s just enough to write a piece of the desired text, and our magic tool will search for it for us and even group it into categories of fragments found in classes, files, symbols, and even menu items. This shortcut is useful as it saves us time when looking up a class, a class method or property, or setting a property.
Shortcut to see last opened files
Ctrl + E opens a popup window with files that we’ve recently opened. Also, in this window, we can start writing the name of the file of interest to us, and the IDE will filter the list. It is handy, especially when we’re coming back the next day and trying to remember what we were working on the previous day.
Alt + Insert shortcut
We press Alt + Insert in the file. We’ll see the popup window that prompts us to override a method, implement methods, add a constructor, getters and setters, and PHPDoc comments. I’m calling this combination, and the combination of Alt + Enter my J.A.R.V.I.S. as they’re generating the code that takes me a few minutes in a few seconds.
Shortcut to refactor
Refactoring the code has never been so easy as it’s by pressing Ctrl + Shift + Alt + T on the highlighted part of the code. After doing so, the window opens, which gives us a rich choice of code refactoring. Before applying the changes, you can select a preview to evaluate which files will be changed. This feature of the PhpStorm mostly gives us a hint of making our code more readable and more efficient because sometimes a developer may miss something and will need a suggestion on how to refactor the code.
Work with PhpStorm - useful tricks
GIT, what it would be without it. Despite shortcuts, PhpStorm offers convenient integration with GIT. It gives us the ability to work with repositories, track file changes, view the difference for the file, make a commit and push from there. It becomes handy while committing, merging, and resolving conflicts. Additionally, you can look at the commit tree on the log tab of the GIT toolbar.
PhpStorm is also great for web development as it offers many features to speed up the development process. One of the most interesting for us is the code generator. You can easily generate HTML without even writing it. Under the hood, IDEA uses Emmet, so you can get familiar with the syntax and use it. For example, if you write "div>ul>li*5", the following code will be generated:
PhpStorm shortcuts - summary
One article isn’t enough to describe all useful PhpStorm shortcuts. Here we covered some of the useful keyboard shortcuts and features of the IDEA, which again proves the point that it makes our development process faster and easier. In our opinion, the regular usage of shortcuts is like working with mini J.A.R.V.I.S, which operates on our needs via keyboard communication.
Do you need help with choosing the right tools or developing your PHP application? Check our PHP development services.