Sudo Rambles
  • Home
  • Privacy Policy
  • About
  • Contact
Categories
  • cheat-sheets (2)
  • guides (11)
  • news (1)
  • ramblings (4)
  • tutorials (10)
  • Uncategorized (9)
Sudo Rambles
Sudo Rambles
  • Home
  • Privacy Policy
  • About
  • Contact
  • guides
  • tutorials

PHPStorm automatic code re-format

  • 17th June 2019

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:

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.

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:

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!

Happy Coding

Previous Article
hacker man gif
  • guides
  • tutorials
  • Uncategorized

Lumen Swagger integration

  • 30th May 2019
View Post
Next Article
  • guides
  • ramblings

Alias a command – Ubuntu

  • 14th August 2019
View Post
Sudo Rambles
  • LinkedIn
  • Twitter
A programmer's blog

Input your search keywords and press Enter.

GDPR notice
This website uses cookies to cache data localy. This means the site loads faster on later visits. Please, indicate if you're ok with this.Yep, that's fineNot my cup of tea Read More
Cookie Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT