Developing with WordPress – part 3: Work faster with VVV tools

As I have mentioned in the first post of this series, the focus is on tools and way to get a faster workflow when developing with WordPress. We have set up VVV in the last 2 posts, today we continue with some ways on how to work faster with VVV.

For all tips mentioned below it requires that VVV is already up and running.

Manage your database

VVV has by default a MariaDB database running which used for all your WordPress sites. When you open the home page of your VVV installation you will see the section “Bundled Tools” and one of the tools listed there is phpMyAdmin. You could use this tool to manage your database and for some quick and light tasks this is a fast way to do so. However, for power users there are other tools available. Tools that give you more options and flexibility to manage your database. I am a big fan of using Sequel Pro but you can use any tool of your liking. The main reason why I mention this is that those tools need to be able to connect to your database on your VVV installation and this is how you do it:

VVV is running on a virtual machine and you should therefor see it as a remote connection. This means you can’t connect to localhost from outside of your code (as you will see in the site you created last week, the wp-config.php points to localhost and that works because this code is actually running on the virtual machine), so we need to connect to the actual host. And luckily VVV has made that very simple for us. It even created a new user for this specific purpose of connecting to the database from outside VVV. Open up Sequel Pro or the tool of your liking and set up a connection with this data:

Host: vvv.test
Username: external
Password: external

And you should now have a working connection to MariaDB and be able to see all the databases of all your sites. Nice!

SSH access

So far we have discussed various terminal commands in the previous posts. Those commands you had to run on your local machine, but what if you want to do something on the virtual machine? VVV got you covered there as well. You can access your machine via SSH and that works out of the box.

Open up your terminal and go to the root folder of your VVV installation. When inside this folder, execute:

$ vagrant ssh

And you are already on the virtual machine. When in here you can check out everything that is running on the virtual machine. For example, in the /srv/www directory you will find all your sites.

As VVV is set up nicely for most of your development you probably won’t need to do this often. There is however one tool that requires you to do this, and that is WP-CLI.

WP-CLI

WP-CLI stands for WordPress Command Line Interface and is hands down my most favorite tool that comes bundled with VVV. There is plenty to be said about WP-CLI and I will do so next week, but for those unfamiliar with it: WP-CLI let’s you do everything on the command line that you would normally do in the WordPress admin. From installing plugins to updating core, exporting/importing databases and much more. Once you get the hang of it you can drastically improve your workflow and cut down hours of working time. Next week we’ll dive into this in more depth.

Share on social media:

Latest blogs