PhpStorm includes a great number of settings that may apply to the IDE, the editor or to the project we are working on. In this tutorial, we'll see where we can find these settings and how they are structured.
PhpStorm can be configured on two levels: the IDE level and the project level. Project settings apply to the project we are working on. If we configure any of these options, they will only apply to the current project on the current machine. IDE settings are global for the IDE: they apply to every project opened, to the editor and so on.
Settings can be opened from the File | Settings menu, or by pressing Ctrl+Alt+S (CMD-, on Mac OS X). In the Settings dialog that opens, we can clearly see these two categories of settings in the list on the left: project settings first, then IDE settings.
Within the Settings dialog, we can easily search for specific settings. The search box at the top lets us search categories as well as individual settings. For example if we search for "theme", the Appearance category will show up, highlighting a specific setting that lets us choose the theme used by PhpStorm.
IDE settings are stored in the user home directory. Check the web help for more information about the exact location. IDE settings can be shared with others by exporting/importing them from the File menu. See #Exporting and Importing IDE settings for more information.
Let's go over a few of the IDE settings. Again, these are global to the IDE on our machine and will be applied whenever we open a project in PhpStorm.
Under the Appearance category, we can pick the general IDE theme. I'm working with the Darcula theme here but there are different themes available.
One popular customization category is Colors & Fonts. Here we can find different color schemes which we can use in the editor. Subcategories show us a preview of these colors and allow us to customize them for different types of languages supported by the editor.
In other tutorials, we've already seen quite some keyboard shortcuts that can be used. From the Keymap category we can select different keymaps to resemble other software keyboard shortcuts. We can also assign shortcuts to menus and actions we often use. For example if we're using the Built-in REST Client in PhpStorm often, we can search for the action to open it and assign a keyboard shortcut to it.
Project settings are stored in the .idea folder within the project. They can be shared with other developers on the team by simply sharing this folder, for example using VCS. Note that it's good practice not to share the workspace.xml file as this contains all the open editor tabs and such, which is nice to keep individualized.
Let's go over a few of the project settings categories. The first category is already an interesting one: coding styles. Depending on the project we are working on, we may want to have the IDE apply a different coding style. From the Code Style category, we can configure how we want code to be formatted.
Under the Inspections category, we can specify which inspections to enable or disable. Inspections will verify code and offer warnings, errors and often quick-fixes to improve code quality. It may make sense to enable them all but disabling some can also be useful.
Typically we can configure everything related to the project we are working on. Project settings may behave differently for some PhpStorm plugins. Some settings are in between IDE and project settings. For example Command Line Tools. We can run command line tools from within our IDE and we may want to have some default tools enabled across projects. The Command Line Tools category lets us choose where the tools are made available: either in the project or globally.
If you find out at some point that you're always configuring the exact same options for every project, you can make them into default project settings. The File | Default Settings menu lets us configure project settings which will be applied to every project created later on. For example, we can set the PHP interpreter options for all projects that are created in the future.
IDE settings are bound to our working environment, our current machine. What if we have multiple machines we want to work on? What if we want to share IDE settings with our team members? We can archive the IDE settings and distribute them using Dropbox, Google Drive or through source control.
From the File | Export Settings... menu, we can export our IDE settings. We can select all of them, or individual subcategories we want to export. For example, we may want to distribute Live Templates but not editor Colors and Fonts.
On other machines, we can use the File | Export Settings... menu to apply these settings in our IDE.