Installing PHPUnit in Visual Studio Code

Once you’ve got the PHP Coding Standards set up in Visual Studio Code, I think it’s also important to make sure that you have PHPUnit installed so that you get in the practice of writing testable code.

If you wait to start doing this until after you’ve started a project, you’re far less likely to start doing it. I’m saying this both from experience and from working with other developers.

So before I start covering how to handle front-end linting and things like that, I want to walk through the process of setting up PHPUnit. If you’ve not yet read how we’re managing packages or how we’re using Visual Studio Code, I recommend catching up by reading the following articles:

  1. A WordPress Development Environment (Using a Package Manager)
  2. An IDE for WordPress Development
  3. Working with User Settings in Visual Studio Code

Once you’re caught up, head back to this post.

Read More

Using PHP Coding Standards in Visual Studio Code

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.

Read More

Working with User Settings in Visual Studio Code

If you’ve not read last weeks post (and you’re a member of the site), then I urge you to do so now as this one picks up exactly where the previous one left off.

In short, we’re going to start talking about configuring Visual Studio Code for professional WordPress development. Of course, that raises a question: What is professional WordPress development?

If you ask ten different people, you’ll probably get 8-10 different answers; however, I’d define it as using professional software development practices within the context of WordPress.

Naturally, right? But what does this entail?

Off the top of my head, I think of:

  • Using proper dependency management tools such as Composer, NPM or Yarn,
  • Debugging using breakpoints (over var_dump and echo),
  • Knowing how to format code using a given standard (PSR in the case that I’ll be using),
  • File organizational structure,
  • Using things like Sass, JavaScript linting, and so on to ease development

But before getting into all of that, I think it’s important to get the IDE set up in such a way that looks good, plays well with the way that we want, and that we understand how it works so we can further tweak it as the need arises.

So in today’s post, we’re going to look at exactly that: Understanding how Visual Studio Code manages settings and a proposed list of configuration options that will help make your experience as solid as possible.

Read More

An IDE for WordPress Development (Regardless of Experience)

In the previous article, I walked through the process of setting up a local development environment using a package manager. Specifically, I talked about using Homebrew to install Valet and Composer.

The former offers the Nginx web server, a MySQL database server, while Homebrew allows you to install PHP. Composer gives you the ability to deal with PHP dependencies. If you’ve not read the post, I highly recommend it as this post is predicated on that entire environment.

Specifically, I’m going to be talking about IDEs. It’s a hot topic, I guess, but if you don’t have a preference then I’m going to walk you through the process of picking one that I think is best (at lest to start with), configuring it, and using it in the context of the environment established last week.

Read More

A WordPress Development Environment (Using a Package Manager)

At this point, I’ve written about as much of the OOP Fundamentals that I believe are necessary to begin looking at more in-depth topics (such as design patterns and how to apply these topics in WordPress development).

But when planning the content, I kept coming back to a few other things that I think are also necessary to cover eventually. These are things such as Composer, Yarn, build tools, and so on.

Above that, though, I kept asking myself:

If I’m going to be writing about this material at length, should I assume we’re all using the same environment?

And that’s a tough question to answer because some of the people reading this have been writing code for quite some time. That is, they (or you) have your tools, your setup, and how you like to organize your projects.

On the other hand, there are those (or you), who are looking for a different way or looking to start from the ground-up. And to that end, I think it’s important to cover two things:

  1. How to Setup a Local Development Environment
  2. What IDE, Add-Ons, and Tools are going to be used

For some, it’s not the most exciting topics and it’s certainly putting a pause on the more advanced aspect of object-oriented programming. Since those of you who pay to read this material have access to the comments, I have to assume that – at some point – comments will come through asking about how to achieve certain things.

And to that end, I’m going to assume that we’re all working off of the same playing field. If not, there’s only so much that I can do to provide help beyond actual programming questions.

So before going any further into the depths of object-oriented programming, I’m going to spend a few posts covering the above topics in detail to make sure that we’re all on the same page.

If you’re comfortable with your tools and your setup, then please bear with me. If you’re looking for a definitive way to setup your environment, then the following posts are for you.

And with all of that said, let’s get started with talking about how to cleanly set up a local development environment that’s easy to maintain.

For Members Only

Thanks for your interest in this article; however, it's available to members only. If you'd like to review this (and have access to all previous and future articles), check out the sign-up page.

Read More