The Ultimate WordPress Development Environment-ThemesReviewCentral

The Pros:
It’s fast, it’s easy, it’s intuitive and will work on all systems all the time. It has a great user interface, which you can use to tweak PHP settings, switch to Nginx, configure Memcached, Postfix, set up virtual servers and more.

The Cons:
While there are many things you can tweak, control is limited. You can’t change the operating system or make other changes that full SSH access would allow you to do.

All AMPs lose in portability for the same reason. They are popular enough that anyone can install them, but they aren’t self-contained and minimal like Vagrant configurations.

Vagrant is a bit different. Instead of pre-packaging and environment for you, it gives you full control. It’s built upon VirtualBox (or other VM apps) and allows you to grab a “box,” which is essentially an operating system. You can then use scripts to configure these for yourself.

The Pros:
Configuration is self-contained in as little as two very small files. If you’re used to the command line setting up an environment can be as simple as vagrant up – the system is extremely portable.

You can configure to your heart’s content. Any operating system, any software, from different caching methods to compiling your own PHP. You can replicate your actual host’s environment exactly to make sure your site will run in exactly the same way on your local machine.

The Cons:
If you’re not up to speed in command line usage Vagrant can have a steep learning curve. When everything works out it’s smooth sailing, all you need to do is issue one command. If something refuses to work, for whatever reason, you’ll find yourself in deep water.

Tools exist to create virtual hosts and perform other common tasks, the UI of MAMP is more convenient, at least for me. If I need a quick new virtual host with a WP install I can do it with MAMP + WP-CLI much faster than with Vagrant + WP-CLI.

If you work exclusively with WordPress, a tool like MAMP offers more than enough flexibility and power. It allows you to work with non-WordPress sites of course, so if you have the odd-job which falls outside the WP sphere MAMP will still serve you well.

If you work with large teams on non-WP projects I recommend grabbing Vagrant and giving it a go. It will teach you a lot about how servers work internally and allow you to share environments exactly.

My preference is to use both. When I need to (or have the time), I can configure my environment down to the last detail with Vagrant. When I need something simple or for a WordPress project, MAMP is my preferred option.

Rachel McCollin, another writer here at WPMU DEV, has written a great guide on how to set up up MAMP and I’ve contributed a Guide to WordPress Development With Vagrant, which you can use to set up these environments.

I don’t use a huge number of CLI tools, but the ones I do use are a large part of my workflow. The most prominent ones are WP-CLI, Gulp, ngrok and Ultrahook let’s go into a little detail.

WP-CLI is an extremely powerful command line tool, which allows you to automate everything about WordPress. I’ve already written a tutorial about Advanced WordPress development with WP-CLI so I’ll show you just some of the magic it can do.

You can download, configure and install WordPress in a few simple commands like wp core download and wp core config. Documentation is plentiful and easy to follow.

I use WP-CLI together with bash scripts to create little templates for new site creation. You can use commands to remove default plugins and themes and download and activate plugins you use regularly.

Database search and replaces are sometimes needed but can be a pain. Changing to https, moving to a new domain, renaming urls and others can all bring with them some mass changes.

Since the database contains a number of serialized arrays you can’t just to an SQL search and replace (unless the old and new value is the same length). wp search-replace oldval newvalue will work all that out for you, unserializing and then re-serializing your arrays.

WP-CLI has built in SSH to help you manage sites over SSH. This has the potential to allow you to manage hundreds of sites with a single command (ie: updating a theme or plugin across multiple sites).

So Much More…

There is almost no end to what you can do with WP-CLI. From around 35 built-in command categories, which contain a bunch of sub-commands to third party packages, you can easily automate any task.

Gulp is my automation workhorse. I use it to manage my scripts, styles, images, even mobile testing and browser refresh mechanics. I wrote an extensive article about Using Gulp With WordPress, take a look there for detailed instructions.

I prefer Gulp to the other popular choice – Grunt – because of the syntax differences. Take a look at my Grunt For WordPress Development article and make up your own mind!

Gulp uses Node and Node packages for its functionality, making it extremely portable and powerful, due to the community-driven extensions. My work process with Gulp usually involves the following:

The only part of this that requires any thinking at all is number four. Even then, most extensions have copy-paste examples which will probably only need to be modified a tiny bit.

Here are the extensions I use most:

ngrok is a small service and command line tool I use to share my local work over the internet. ngrok creates secure tunnels to a local environment, exposing your application on a special URL like http://7bbc49aa.ngrok.io.

Ultrahook is kind of the reverse of ngrok. Where ngrok routes your localhost to the web, ultrahook routes the web to your localhost. This is extremely useful for testing third party APIs like Stripe for example.

You can set Stripe up to send test webhooks to http://stripe.danielpataki.ultrahook.com which will be passed securely to your local server.

For most of us WordPress development is synonymous with plugin and theme development. The repository is full of plugins that help developers create better work faster. Here are some I use or used regularly.

A must-use plugin for theme creators. Theme Check will analyze your theme and spit out reasons it doesn’t meet the WordPress standards. It looks at deprecated code, extraneous files, bad practices, common errors and tons of other potential problems.

Do you think supporting right-to-left languages is easy? Think again! It’s not so much a technical challenge but those who read/write exclusively from left to right find RTL so alien that it’s difficult to see issues without actually testing. RTL Tester makes it super easy by allowing you to put your site in RTL mode with the flick of a switch.

Advanced Custom Fields or ACF is my all-time favorite plugin. It allows developers to create beautiful custom fields for their themes and plugins in an intuitive and quick UI. Once you’re done you can hide ACF altogether and paste the generated PHP code into your work to keep the fields intact. A well-executed and hugely useful plugin!

The Query Monitor allows you to see exactly what’s going on in your WordPress environment from a database access point of view. You can catch potentially slow or redundant queries before they go out into a live product and optimize existing ones to make your code that much faster.

Bash scripts contain a bunch of commands that are run one after the other and can be used to further automate tasks. For example, it’s already easy to install WordPress with WP-CLI. All it takes is the following:

These commands must be issued one after the other, which takes a bit of time. By placing this in a file, let’s call it install.sh, you can create a template for creating a WP install.

Place the file in the folder you want to create the installation in and type bash install.sh. All the commands will be issued and in a few seconds you’ll have a site up and running.

By adding parameters you can make it even more useful. If you issue the command like this: bash install.sh newsite you can use the parameter to fill out the database name, the URL and site title.

Bash files can also be useful for creating final builds (removing extraneous folders and files, moving directories, etc. ) and other similar tasks. They can even be run from Gulp tasks which gives you a lot of flexibility in your workflow.

Browser extensions are a great help when testing a site. Here are some that I use in my workflow.

Postman is a chrome extension for building, testing and documenting APIs. I find that whenever I need to shoot a quick request to see how an API works Postman is far faster than any other tool.

The ability to save and manage requests is particularly useful. API testing is something I do less frequently but when I get around to it, it takes up most of my day, using something like Postman makes my life so much easier.

EditThisCookie is another example of a Chrome extension which I don’t use a whole lot, but when I do it saves me hours upon hours. It lets you see/clear/edit a single site’s cookies. That’s all, but oh my, how handy it can be!

Page Load Time does what you’d thing, it analyzes the page load. It can go into important details like DNS/Request and response times, but what I like is that it shows the overall load time right there in the toolbar. Super-handy for quick comparisons.

My final browser extension entry into the misc tools category is JSON Formatter, which detects when a response is simply a JSON string and formats it all nice and proper instead of just plopping out a block of text.

This one actually has nothing to do with development! Franz is a tool that can aggregate a number of web services under one roof. My Messenger, Slack, Skype, Inbox by Gmail, Trello, Google Calendar and Todoist apps all run in one window instead of their native apps.

It all looks exactly as if I ran them in their usual environments but I don’t need to have all those icons and I can switch between them more easily. I mention Franz because it has helped me focus more while also communicating better.

Varying Vagrant Vagrants or VVV for short is an open source Vagrant configuration for developing for WordPress and WordPress itself. It contains all the tools you’ll need to get started, including development builds of WordPress.

There are so many tools I haven’t mentioned, mostly because I simply don’t use them. They are great tools but I just haven’t gotten around to them, don’t need them or they don’t fit in my workflow. Here’s a short list of some greatness you should take a look at:

In conclusion, these are the tools I use – they might not necessarily be the best fit for you, nor are they the best fit for every situation. This setup is flexible enough for my needs, so please do take the time to research options and create a workflow that feels right to you.