in Open-Source, WordPress

Introducing MagicPress

The other day I saw Aaron Rutley tweet about a tool he’d built called ValetPress:

It combined two of my favourite things – WordPress & Laravel Valet. If you’re reading my blog, you likely already know what WordPress is but may not know about Valet.

Valet is a Laravel development environment for Mac minimalists. No Vagrant, No Apache, No Nginx, No /etc/hosts file. You can even share your sites publicly using local tunnels. Yeah, we like it too.

Laravel Valet configures your Mac to always run Caddy in the background when your machine starts. Then, using DnsMasq, Valet proxies all requests on the *.dev domain to point to sites installed on your local machine.

In other words, a blazing fast Laravel development environment that uses roughly 7mb of RAM. Valet isn’t a complete replacement for Vagrant or Homestead, but provides a great alternative if you want flexible basics, prefer extreme speed, or are working on a machine with a limited amount of RAM.

It’s not for everyone, but I’ve found it to be sufficient for quickly prototyping new things and keeping my MBP’s battery alive more than a couple hours.

Aaron’s solution is awesome – he’s introduced a new command that allows you to quickly spin up new Valet powered WordPress sites using WP-CLI.

I wanted to try make the install process a little bit easier, have always wanted to build a Node CLI app and selfishly, wanted some specific commands for making WooCommerce development sites, so I got inspired and put together MagicPress.

If you’ve already got Valet and WP-CLI installed, you just need one more command to get started with MagicPress.

npm install magicpress -g

For the rest, check the docs. You may need to configure the MySQL username/password if yours isn’t rootroot. To do that, just run:

sudo mp config

At this point, you’re ready to to create new WordPress development sites! The good news? It’s almost instant:

mp new sitename is now a functioning WordPress installation with a DB and everything!

Check out the docs as things have likely changed since I wrote this, but one of my favourite optional commands is –woocommerce. Append it to the end of your mp new command and the new site will have a copy of WooCommerce installed, along with the Storefront theme.

mp new woo --woocommerce

There’s also the –dev command that I highly recommend using, which will install a bunch of useful developer-friendly plugins like Query Monitor. I hope to add some more commands and delete functionality soon, but for now, I’m interested to see if others find this as useful as I have!

PS. It’s MIT-licensed, so you can pretty much do whatever you want with it (except blame me if something breaks). 🙂

Photo by Thomas Kelley

Write a Comment