Web developer, Linux enthusiast, father and husband. I like to write about programming.
As a Magento developer, you are dealing with a complex code-base that you have to navigate through. That is why it is useful to have an IDE (Integrated Development Environment) that helps you write your code and ensure its quality.
Perhaps one of the most famous IDE for PHP developers is PHPStorm. PHPStorm comes out of the box with all the tools you need for writing PHP applications. Here are some tips and tricks about my PHPStorm configurations that I use as a Magento Developer on a daily basis.
I will not cover the following: keyboard shortcuts, fonts, and color schemes, since they will be different for everyone. Eventually I will share my settings.zip with you for download.
Go to the menu bar and hide what you don’t need:
Show options menu
✔ Compact directories (Ensures less nesting of empty folders)
View > Appearance
Hide the following:
☐ Tool Window Bars
☐ Status Bar
☐ Navigation bar
Then go to Phpstorm -> Preferences or open “Preferences” with the key combination ⌘ + ,
Appearance & Behavior > Appearance
☐ Animate windows
☐ Show tool window numbers
☐ Allow merging buttons on dialogs
☐ Show tool window bars
☐ Disable mnemonics in menu
Appearance & Behavior > System Settings
☐ Reopen last project on startup
☐ Confirm application exit
✔ Open project in new window
Editor > General > Breadcrumbs
☐ Show Breadcrumbs
Editor > General
☐ Enable Drag and Drop functionality in editor
☐ Show notification after reformat code action
✔ Ensure line feed at file end on save
This gives us a more organized folder structure with only the folders we care about.
I like to keep it as minimal as possible by only installing essential plugins, these are as follows:
- IdeaVim - Vim emulation plug-in for IDEs based on the IntelliJ platform
- Magento PhpStorm - Official Magento PhpStorm plugin for Magento 2
- MaGinto - Plugin, created to improve life-work balance while working with Magento 2
- PHPAnnotation - Extends PhpStorm to support annotations in DocBlocks
- Symfony Support - Support for Symfony framework / components.
- BashSupport - Adds extra support for bash scripts
- CSV Plugin - Lightweight plugin for editing CSV/TSV/PSV files
- .env files support - easy support for dotenv files
- Solarized Themes - Adds Solarized Dark and Light color themes.
Configure PHP Codesniffer (phpcs), PHP Mess detector (phpms) and PHP CS Fixer
⌘ +, Language & Framework -> PHP -> Quality tools -> PHP CodeSniffer -> …
- PHP_CodeSniffer path:
- Path to phpcbf:
- Click the “Validate” button to make sure everything is set-up right.
Repeat the same steps for Mess Detector and PHP CS Fixer. You can find these files under:
And lastly, don’t forget to backup your configuration by going to Files -> Manage IDE Settings -> Export Settings, you can download mine in here.
This is the end of my blog, if I missed something or you have any settings you want to share, please leave a comment below.
Previously behind paywall at: https://medium.com/dev-genius/the-complete-phpstorm-setup-for-magento-2-7776d4156c1e