So we’ve got the basics set up in Visual Studio Code set up, but we don’t have any practical tools installed to help us with more of the professional side of writing code.
Of course, “professional” can be defined based on the company, team, or environment in which you’re working. For this series, I’ve opted to go with WordPress as the foundation. But that still leaves things such as:
- coding standards,
- JavaScript linting,
- package management,
- And so on.
And throughout the series, I’m going to cover everything listed above. But to do so, I’m going to cover each component one-by-one.
Today’s post is going to focus on the PHP coding standards. I’ve written plenty of material regarding the WordPress Coding Standards, but in the last year or more, I’ve begun to work more with PSR, and so that’s what will be covered in this post.
As a side note, know that much of what is covered can be translated to the WordPress Coding Standards should you so choose, and it’s going to be clear as to where you’d make the changes.
With that said, let’s get started.
PHP Coding Standard in Visual Studio Code
First, please make sure you have the pre-requisites all of which are covered in previous posts in this series. Namely:
Each of the above walks through how to setup, configure, and manage Visual Studio Code and the basics of understanding user settings (along with preferred fonts and the like).
And with that, it’s time to install support for code sniffing and rules for PHP coding styles based on PSR-2.
What About Front-end Work?
As important as it is to make sure our code is up to the proper quality of the server-side work, what about CSS (or Sass or LESS) or JavaScript?
There are also tools specifically for that, and we’re going to resume covering that material in the next post.
For now, focus on setting up PHP Coding Standards in Code, check out what you can be doing better to improve your styles, and we’ll go from there.