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:
✔ Compact directories (Ensures less nesting of empty folders)
Hide the following:
☐ Tool Window Bars
☐ Status Bar
☐ Navigation bar
Then go to Phpstorm -> Preferences or open “Preferences” with the key combination ⌘ + ,
☐ Show tool window numbers
☐ Show tool window bars
☐ Enable mnemonics in menu
☐ Reopen projects on startup
☐ Confirm before exiting the IDE
✔ Open project in new window
☐ Show Breadcrumbs
✔ Ensure an empty line at the end of a file 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
- PHP Annotation - 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.
⌘ + , Code Style -> PHP -> Set from… -> PSR1/PSR2
⌘ +, Language & Framework -> PHP -> Quality tools -> PHP CodeSniffer -> …
- PHP_CodeSniffer path: <Magento_Root>/vendor/bin/phpcs
- Path to phpcbf: <Magento_Root>/vendor/bin/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: <Magento_Root>/vendor/bin/
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 .