This is my global configuration for PhpStorm, my favorite IDE for PHP. I have some custom configuration for code styling, inspections and file templates, and I use Git to track these configuration files and to synchronize them between workstations. The code style rules are based on PSR-1, PSR-2 and PSR-12 (which is still a proposal) but I also added some things that are not specified in the PSR guidelines.
Base on Nic Wortel phpstorm-ide-config
Feel free to use or fork this repository. Note that I use PhpStorm 2017.3. I cannot guarantee compatibility with other versions of PhpStorm.
Some configuration is specifically for the Php Inspections (EA Extended) plugin. I guess this is ignored when you don't have the plugin.
- .env files support
- .ignore
- deep-assoc-completion
- EditorConfig
- PHP Annotations
- PHP Class Templates
- PHP composer.json support
- PHP inheritDoc helper
- Php Inspections (EA Extended)
- PHP Toolbox
- PhpMetrics
- PHPUnit code coverage
- PHPUnit Enhancement
- String Manipulation
- Symfony Plugin
- Twig Support
If you use
- SensioLabsInsight
Language | Standards |
---|---|
PHP | PSR-1, PSR-2, PSR-12 |
HTML / Twig | 4 spaces |
CSS / SCSS / LESS | 2 spaces |
Yaml | 2 spaces |
Before you do this, make sure PhpStorm is not running, or it will overwrite the changed files before shutting down.
Use the following commands to go to the config directory, remove some default directories, and pull the files from my repository:
# replace with the actual directory name, depending on OS and PhpStorm version (see below).
cd ~/.PhpStorm2017.3/config
# remove the files and folders that are in this repository
rm -r codestyles/
rm -r fileTemplates/
rm -r inspection/
git init
git remote add origin [email protected]:nicwortel/phpstorm-ide-config.git
git fetch
git checkout -t origin/master
OS | Location |
---|---|
Windows | C:\Users\<User name>\.PhpStorm2017.3\config |
Linux | ~/.PhpStorm2017.3/config |
OS X | ~/Library/Preferences/PhpStorm2017.3 |
See Project and IDE settings for more information about the configuration directory structure.
Directory | Contents |
---|---|
codestyles | Code Style settings (Editor > Code Style) |
colors | Colors & Fonts settings (Editor > Colors & Fonts) |
fileTemplates | File and Code Templates (Editor > File and Code Templates) |
filetypes | File Types (Editor > File Types) |
inspection | Inspection profiles (Editor > Inspections) |
keymaps | Keyboard shortcuts (Keymap) |
templates | Live templates (Editor > Live Templates) |