Intro
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.
Go to File->Settings->Editor->Code Style->PHP
You should see this screen:
![](https://www.sudorambles.com/wp-content/uploads/2019/06/Screenshot-from-2019-06-17-20-30-36-1024x776.png)
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:
![](https://www.sudorambles.com/wp-content/uploads/2019/06/Screenshot-from-2019-06-17-20-34-08-1024x233.png)
Restart the beast, and let’s move on.
The config
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:
![](https://www.sudorambles.com/wp-content/uploads/2019/06/Screenshot-from-2019-06-17-20-38-36-1024x463.png)
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:
![](https://www.sudorambles.com/wp-content/uploads/2019/06/Screenshot-from-2019-06-17-20-40-14-1024x532.png)
That’s it peeps. Hit CTRL+S
and enjoy the auto-magic formatting.
Long live laziness!