Core points
In recent years, WordPress development tools have made great progress. In the past, developing a WordPress website required some kind of MAMP/WAMP localhost setup and it was almost always cumbersome. Maybe you are even a developer who develops a website in a production environment - I used to be.
Luckily, times have changed, and now there are tools that can help you eliminate the hassle and repetitive work of building a WordPress website on your computer.
Last December, three years after I was almost completely out of any WordPress development, I became a full-time WordPress developer. Before that, I worked in the payments industry for three years before being a full-time WordPress signing.
Three years away from a certain industry gave me a unique perspective on the speed of change in the field of computing, more specifically, the Web development field. WordPress development is no exception.
You see, when I returned to WordPress development last December, I decided to look at how to build a perfect WordPress development environment. To my surprise, the tools around WordPress have improved so much, it’s like trading a Ferrari for a Ford.
I am very excited, of course, still excited, to explore all the tools, and in today's post I will share with you the summary of what I have learned. Hopefully it helps you adjust your current environment and implement some of the available tools.
Start with the server
First of all, the most important part of the WordPress development environment problem is the server. Without a server, we can do nothing.
There are many different options for hosting WordPress websites in a local environment today, so it’s hard to know which one to use.
I suggest you give up MAMP/WAMP/XAMP and start using a virtualized development environment.
Why? There are many reasons:
Now that you have accepted the virtualization environment. What should you use?
I am using VVV. It's very easy to get up and running, has a good support system, and it's used by many large WordPress development agencies, including the XWP I work for.
Some other options for virtualized WordPress development environments include: HGV, Wocker, VIP Quickstart.
If you decide to use VVV, then I definitely recommend the following plugins and tools to take VVV to a higher level.
Aleksander Koko has written about VVV before, and I recently recorded a video on how to set up VVV on your own computer.
The power of the command line
Who doesn't like a little command line operation? WP-CLI is the answer to your inner command line wish.
WP-CLI allows you to manage WordPress installations from the command line (it is provided with VVV by the way).
Let's look at some practical examples of how to use WP-CLI in a local development environment.
All of these are very convenient operations you can do from the command line. Even better, in the next section, we will discuss the IDE where you can run all of these commands directly.
If you are interested in learning more, check out this article by Ahsan Parwez about WP-CLI.
IDE that changes the pattern
Of all the tools I talked about today, I think this will be the most controversial. When it comes to IDEs and editors, it's almost like invading personal space, which many people don't like.
I won't try to tell you that IDE is better than text editors and vice versa. What I want to do is tell you my experience switching to IDE and how it works for me.
I have always been a person who doesn't like IDE. Not liking it may be an euphemism, I hate them. I think they are bloated, slow and messy.
I used to be a big fan of Sublime Text (I am still, by the way, and I use it every day).
So, in December, when I started WordPress development again, I looked at which editors could be used to write WordPress code. I was very surprised when I kept mentioning the IDE called PhpStorm.
I glanced reluctantly and I was so glad I did!
PhpStorm is the best PHP and WordPress development IDE in my opinion. It offers everything you need to build WordPress websites, plugins, and themes, and has an incredible WordPress integration (you really need to check it out).
The following are three reasons why you should consider using PhpStorm for WordPress development this year:
If you are interested in getting started with PhpStorm, check out a series of 7 PhpStorm videos I have recorded to help you get started with this IDE.
Make sure your code is clean and tidy
The last tool I want to write about today is a good thing! I'm particularly particular about writing code. I love that it is clean and tidy and follows WordPress code specifications completely.
But even so particular, we are all human beings. And I often find myself browsing the code I wrote and being upset about missing spaces or extra line breaks.
In the open source world, it is very important for developers to stick to the code specifications defined by the project, otherwise the code base will degrade very quickly, especially on popular open source projects like WordPress.
In fact, the WordPress core team is particularly strict with code specifications and their compliance.
So, how do we make sure our code follows WordPress code specifications? The answer is simple, it is a tool called PHP CodeSniffer with a WordPress code specification rule set.
The two utilities will scan your code for any differences between your code and how your WordPress project is expected to be written, and let you know what went wrong. So amazing!
Best thing is that they also inform you of any advanced security issues you have. Of course, it won't capture every security issue, so make sure you always consider security when writing your code, but it's the first line of defense.
Of course, I can't complete this section without mentioning that PhpStorm has built-in support for PHP CodeSniffer. I've posted a video on how to combine the rulesets for PhpStorm, PHPCS and WordPress code specifications.
Conclusion
There are many alternatives besides the aforementioned tools, and I hope at least everything I talked about today will make you interested in exploring some of the great tools around WordPress development.
If you choose to use the above tools, these tools will provide you with a good foundation to start with a streamlined and automated approach to WordPress development.
If you use other tools, I'd love to hear your comments in the comments below!
Frequently Asked Questions about WordPress Development Environment
The WordPress development environment is a secure, isolated space where developers can test changes, updates, and new features of WordPress websites without affecting production websites. It is crucial because it allows developers to identify and fix any issues or errors before they affect production sites, ensuring a smooth user experience. It usually consists of three stages: local (the developer's machine), temporary storage (the copy of the production website), and production (the production website).
Setting up a local WordPress development environment includes installing a local server environment such as MAMP, WAMP, or XAMPP. Once installed, you can install WordPress on your local server. This allows you to process WordPress websites directly from your computer without an internet connection.
The staging environment is a clone of your production website where you can test changes without affecting the production website. It is beneficial because it allows you to troubleshoot issues, test updates, and make changes without risking producing website features. It also provides customers with a platform for review and approval before the changes go live.
Migrating your WordPress website from your local environment to a production server includes migrating files and databases for your website. You can do this manually or use plug-ins like Duplicator or All-in-One WP Migration. Always remember to back up your production website before migrating to prevent any data loss.
There are many tools available for WordPress development. These include code editors such as Sublime Text or Atom, local development environments such as Local by Flywheel or DesktopServer, version control systems such as Git, and debugging tools such as Query Monitor or Debug Bar.
Creating a child theme in WordPress involves creating a new directory in the theme folder, creating a style.css file with a specific title, and importing the style of the parent theme. You can then activate the child theme from the WordPress dashboard and start customizing it without affecting the parent theme.
Safely updating your WordPress site includes backing up your site, testing updates in a staging environment, and then applying updates to your production site. This ensures that if there are any problems during the update process, you can easily restore the website to its previous state.
Version control system is a tool that tracks how your code changes over time. It is crucial in WordPress development because it allows you to restore to previous versions of your code when something goes wrong, collaborate with other developers, and keep a history of changes. Git is a popular version control system used in WordPress development.
Troubleshooting issues in WordPress websites include identifying issues, testing solutions in a staging environment, and applying fixes to production sites. Tools like Query Monitor or Debug Bar can help you identify problems. Remember to back up your website before troubleshooting.
Optimize your WordPress website to improve performance includes using cache plugins, optimizing images, using content distribution network (CDN), and minimizing CSS and JavaScript files. You can also use tools like Google PageSpeed Insights or GTmetrix to identify areas that need improvement.
The above is the detailed content of The Ultimate WordPress Development Environment. For more information, please follow other related articles on the PHP Chinese website!