This is going to be a quick one, promise. First of all, if you don’t know what PHPStorm is, click here: Link I believe it is the best PHP IDE on the market today. You can set a coding standard inside of the IDE, and your code will be formatted to match that if you press a key combination. You don’t want to do that 7000 times a day, you say? Read on then. This guide is for laziness sake – let the computer do it for you. Let’s get started.
Setting a code standard
Right, let’s get you set up. If you’re already working under a specific standard, like PSR1, and have setup the latter within PHPStorm, jump to the next step.
You should see this screen:
On the right-hand-side button (“Set from…”), select your preferred coding style. For this example, I’ll pick PSR1/PSR2.
Awesome, that’s it, hit Apply/OK and let’s go get the plugin
Getting them plugins
Go ahead and grab the following awesomeness from here: Save Actions plugin
Hint, hint – there’s an inbuilt Plugins section that you can also install this from, from within PHPStorm itself
Once you install it, the IDE will prompt you to restart, here’s what that looks like:
Restart the beast, and let’s move on.
To configure the plugin, head back to
File->Settings->Other settings->Save Actions
This section is pretty self-explanatory, but you can take a look at my configuration for reference:
Further, when I work with Laravel, or Lumen, I would like the plugin to ignore the vendor folder and all files inside of it. This is achieved by adding the folder to the ignore list, with the following syntax
vendor/.*. And here’s how the plugin will display that:
That’s it peeps. Hit
CTRL+S and enjoy the auto-magic formatting.
Long live laziness!