 As she said, my name is Moonus. I'm a happiness engineer with the automatic. I have a seventh degree black belt in hanging out. And I'm an equal opportunities hugs dispenser. So you need, or one, hugged at any time. Just find me and do that. You can get one. I'm also running a really nice promo on that. You've got unlimited refills, so don't be ashamed. So basically, I'm going to talk to you about a couple of things. In my work as a happiness engineer, primarily what I do is I provide support for customers who are building websites from commerce. So anyone who's bought premium plug-in or extension from us will get support from us. And typically what happens is, someone says, oh, Stripe is acting up and I can't get paid. Or PayPal won't work properly. For me to figure out what's going on, I need to either look at your site or, first of all, test with a local instance where all that's running is Google Commerce and that plug-in to make sure that it works and there's no plug-in there. Before we then look out, OK, fine. What is going on on your site and what could be wrong? To do that, I realize that I'll have to start a brand new site pretty much for every client. And install just the plug-ins that they need to make sure that everything is running fine. It was kind of hard because I was using different development environments. So I started out using MAMP, moved on to local by Flywheel, tried stuff with Vagrant, all of which are good and very powerful. But I'm also lazy, which means that I have all the things running on my computer all the time. I have like 40 tabs opening Chrome. I never minimize anything. I don't close anything. I just command tab to switch context for everything, which means that halfway through the day, the computer is running really slow. And I can't get anything done. I'm in live chat, and I'm trying to tell you what's going on, but I need like five minutes to set up a brand new site. I can make it work, but I figured we could do something better. So I want to talk to you about a Blazing Fast local development setup, and then I'm going to move on into making magic with WPCLI, and then supercharging your terminal experience. So the first thing we'll talk about is the development setup. What I use is Laval valet. Or I started out using Laval valet. I was introduced to me by one of my colleagues. And what it is is an open source development environment. It was set up primarily for Mac users. So it's a PHP development environment for Mac minimalists. So what I really like about it, no vagrant, no Docker. You don't have to mess around with your ETC host's file and no headaches. It's also pretty fast. It uses only about 7 meg of RAM, which means that for lazy people like me who don't like to shut things down and start them up again, I can just leave it running all the time. Now, when you set this up, what it does is it configures your Mac to always run Nginx in the background. And like I said, it's always running. It means that I don't have to start it and stop it whenever I need it. It uses DN mask as a proxy so that all requests on the start up, on the test domain will route to a site that's installed on your local machine. So for example, if you set up WCbrighton.test and you try to reach that, it will go to the site on your local machine instead of trying to go through Google to figure out where the DNS for that is. As I said before, it's perfect if you prefer extreme speed or you're working on a machine with limited amounts of RAM. It uses only 7 meg of RAM. So even if you have an older computer, it'll work. Out of the box, it has support for 20 plus frameworks and CMSs. So you've got WordPress. You've got Drupal sync, Magento, and a couple of symphony. If you want to run just a bare bones PHP website or even just a HTML site, you can power with this as well. And if you've got any CMS that you want to work with that isn't currently supported, there's custom drivers that there's documentation on how to do a custom driver so that you can get it to work. Now, I said before that it was built for a Mac minimalist, but because it's open source and not everyone uses a Mac, some fantastic people decided that we shouldn't leave out people who use Linux or Windows. And so there's a valet windows and valet Linux. And it's pretty much the same. The implementation for Windows is different in terms of like, it doesn't use the end mass, it uses something else, but the end result is the same. Now, after using valet for a while, I found something called valet plus. Now, one company decided that this is really cool, but we want to add a few more things. And they made a third party fork of the valet project and added a few tools to it. They called it valet plus. Even though it's a fork, it maintains close ties to the original. So anything that's released in the level of valet makes its way almost immediately into valet plus. And then they just keep the additional stuff that they have. So some of the features that I like, for example, you've got PHP version switching. So I'm testing the site. I always have it set with PHP 7.1, but the user, for some reason, has 5.6. And I want to figure out if the problem is because of the PHP version, I can quickly change the version of PHP. Now, right now, it doesn't support switching the version of PHP on a per-project basis. When you switch the version, it switches for the entire system. But there's an issue open in GitHub. And if you feel inspired, you can submit a PR for that. That would be welcome. It includes X-debug support. How many people know what X-debug is? Awesome. So for those that don't really know what X-debug is, it's a fantastic tool framework that helps you to debug whatever you're working in. What's a quick example that I can give for that? Essentially, it's a framework that lets you see what's going on without having to rely on. Typically, if we're trying to debug something, historically, I'll do something like just printing out a random value to see if the execution got to that point of the code. But with X-debug, I can step into a function and go through each step and see if the things that are supposed to be happening there are happening. The values that I expect to be assigned to a variable are working. It also comes with something that I really like called MailHog. What MailHog does is it lets you capture emails sent on your local server. Typically, when you set up a local development environment, you don't have an email server on it. So if you're building, say, a WooCommerce site and you want to confirm that when someone buys something, they get an email telling them your order is successful and this is how you download it, but there's no way for you to confirm that the emails work. Sometimes, if you're lucky, whatever system you're using will have an email server, but it will require you to be connected to the internet. And then you'd have to send that email to your own Gmail account or whatever account that you use. With this, it's local. It has its own local interface. Whatever email address you send to, you get it delivered into a site that you can check locally. With this, it sets it up at MailHog.test. So everything uses the .test tld. And then you can go in there, confirm that everything is working. Another really cool feature is sub-domains. So using the commands that you see there, you can easily say something like 2018.workambritten.test. And it makes it easy for you to do anything like what do you call it? You're doing multi-site WordPress multi-site. Then you can easily set up the sub-domains. And also, you can use it to separate projects. And I really like the fact that it comes already installed with WPCLi. And this is a key part of the two-chain for me, because it lets me do things really quickly. We all know what it's like to install WordPress in the browser. It's a five-minute install. It's pretty quick. With WPCLi, you can do that even quicker. Installing plugins, installing themes, activating them, deactivating them, deleting them, doing things with transients. Pretty much anything you can do in the browser, you can do really, really quickly in the command line terminal with WPCLi. Now, for anyone who's already using Vale, for anyone who has anyone here using Vale, anyone heard of Laval Vale at all? So just answer the people. If you're using Vale and you want to migrate to Vale Plus, because of some of the cool things that it has. And I haven't mentioned all of them. I just touched on the few that I really use. It's a pretty straightforward process. Who's familiar with Composer here? Awesome. So all of this relies on Composer. You install the Vale Plus through Composer. You take out Laval Vale, because what they've done is, since it essentially keeps the same features as Laval Vale, it uses the same Vale commands. So you have to remove Laval Vale so you don't have any conflicts. And then you run the Vale install command, and you're pretty much done. Those are the lines of code that you run. And once you've got this sorted, the next thing is how do you serve sites? How do you make sure that people can actually, or that you can see the sites that you're working on? And like I said, it's super easy steps. You make a site directory. Once you've done that, you go in there, and you run the command Vale Park. Any folder in which you run Vale Park, what that tells the system is, if you create a folder, so say I've gone to my site folder and I create a folder called John. Whenever I go into the browser and hit John.test, it's going to refer to that folder called John. So if I create a folder called Brighton, if I go into the browser and see Brighton.test, it will go into that folder to look for the site. Once we've sorted all of this out, what makes this really interesting for me is the stuff that we can do with WPCLI. For a lot of people, working in the command line is like, oh my God, this is scary. I have to be a geek to understand this stuff. But it's not that difficult. WPCLI makes things really, really easy. And I'm going to show you a few things and a few tricks that I've come up with that makes things faster for me. So we're going to look at what it is like to set up a new WordPress site using WPCLI. And Matt, so this is essentially just a recording of me doing things in the terminal. So we're working with a site called, it's going to be Andromeda.test. All I did was make a new direction and go into it. WPCLI downloads a version of WordPress for you. When I did this, 4.9.2 was the most recent one and I had already installed it on a different site. So you can see that it's pulling from a local cache. If there was a newer version, it would pull that directly from the repo and install it. Once that was done, all I needed to do was then set up the WPCLI file. And all I did was specify the database name, database user, database password. I'd already created the database in MySQL. You can use whatever tool you like. I use SQL, sorry, SQL Pro. It's a Mac app. Once that's done, WPDB actually creates the database based on all the information you put in the config file. And supplying all of this information, like the URL, the title, admin username, admin email address, password, will set everything up for you. And once that's done, the site will be available for you at Andromeda.test. You launch it in your browser and you're done. Even with my slow typing, this took less than two minutes to get everything sorted. So there, I'm saying Valet Secure Andromeda will create a self-signed SSL certificate because if you're doing something with e-commerce, so you want to test Stripe or something like that, you need to have an SSL certificate. And that'll get that done for you. Essentially, it just does a quick restart of everything. And you see that it says that the site is now secured with a certificate and it's ready. You can just launch it and you can go ahead and do what you like. Now, well, that is cool. What is even cooler is I found this, so with WPCL, you can write your own third-party commands for it. It has lots of commands, so you've got WP plug-in install, to install plug-in, WP theme install, to install a theme, WP plug-in activate to activate a theme, and all the commands that you're used to, you can call. But if you've got something else that you want to do, you can write your own commands to do it. I found this one specifically for Valet, and I'm going to show you how it works. So, unless you do two things primarily. One, you can create a new WordPress install super fast. So, with one command, pretty much everything you saw me type there. I'll type one command and get all of that at once. And if I've made a bollocks of it and I want to delete it, I can just destroy that with one command as well. So, we're trying to create the same Andromeda site. And all I've done here is supply the name of the site. It takes a while, and I think I bungled my password the first time because it required me to enter my admin password. And after running all of that in the background, all of this took less than a minute, including the time when I entered the wrong admin password. And when it was all done, I had the site Andromeda test set up with an SSL certificate. And I could just go from there and do whatever it was that I was trying to do. It says success, the site is ready. You see that the URL there has HTTPS, which means that it's already secure. So, for me, I'm in a situation where I'm in live chat and someone's asking me about something. It'll take me, I can say, give me a few minutes to test this out. I run this one command, it sets this up, and then I can go ahead and install the plugin that I want and then go from there. Well, that is cool. We can get even cooler because WPCLI has config files. So, instead of having to supply all of the information that you want in the command line, you can set defaults in a config file that let you kind of tell it what to expect and just do things automatically for you. Now, there's kind of five levels where you can send, you can pass information to it. Either through the command line, which means that you'd have to supply things like the username you want to use, the password you want to use, the email address you want to use, and that kind of thing. Or you can have the WPCLI local.yaml file inside the current directory. Or you can have a WPCLI yaml file inside the current directory or upwards. Or number four, which is my favorite, is a WPCLI config.yaml file where you set your defaults and everything goes from there. There are some defaults in the WPCLI itself, but obviously if you want to personalize it for your settings, you're going to want to use one of these files. Now, I'm going to go ahead and talk about my WPCLI config yaml file and how I set it up, and then I'll walk you through a demo of how this works in practice. So, the first thing we're going to look at there is the core config. Remember that the first time we ran wp-config-create, so that's how you tell the config.php file what you want. I've set the database user to root, the database file to root because that's what my MySQL is set up with. I've also passed some extra PHP in there, so I've set wp-debug-to-true and debug-log-to-true, which means that if there's a problem, I want to log it and I want it to be logged in a debug log. I've defined debug-display as false, so the errors won't show on the page, but they'll show in the log. If you want them to show on the page because you don't want to be messing about in logs, you set that to true and you're good. I've also set it to not-display-errors, and WCS-debug set to true there is for commerce subscriptions, and I stole that from my good friend, Gabor. The link at the bottom there, you'll notice some links at the bottom of certain pages on the slides. Those links will take you directly to the code in GitHub just so you can look at them later and you can copy them if you want to. So the next bit is core download. You'll notice from the first time as well, we did a wp-core download. What I've done here is now you can set a locale. By default, it will be English US, but if you speak a different language, so if you're Dutch, you use NLNL, and I left that there commented just so that I remember that if I have a need to, I can change the locale for any site that I'm installing, and skip content true. What that does is it doesn't install all the default themes and plugins because usually what happens is I want to set up a site, install WooCommerce, and install Storefront. I don't need to install 2017 and all the other themes. I don't need to install HelloDully, so that takes care of that. For core install, which would then start the install, my admin user is always luminous, password is always password. It's on my local computer, so it's not for consumption by anyone else. And I set the admin email as adminattestdomain.test. And this is a really interesting bit. This is for the WPValay command, which is what I used for the second demo, where we ran only one command and the whole site was ready. So valay new is we set up the site by saying WPValay new and then the name of the site. So I'm passing the admin user I want, which is luminous, admin password as password, and database password as root. And then for valay destroy, when you run WPValay destroy and Dramada, it will ask you, do you want to destroy the site? I have it set to yes, because I don't run that command for shits and giggles. If I'm doing that, it's because I really want to destroy the site. Now, because of the fact that I have all those things in there, that's why when I ran that command, I didn't have to pass any other information to it. Also, I wanted to override some of the defaults in the setup. That's why I did it like that. Now, I went a step further, because yes, we can get the site set up. But I always want, when I'm doing this, I want to set up a new site with WooCommerce and Storefront. And because I'm lazy, I don't want to have to log into the WP admin. So I found a way to run a single script that will install the site, install WooCommerce and activate it. Install Storefront and activate it. It would generate a magic link to log in. And then it would launch my default browser. So I would already be logged into WP admin. Then I can go ahead and do any settings that I wanted. So I'm going to show you the batch script that I did and just walk you through that as well. So I created this script called WC site. And like I said, it will install and activate WooCommerce. Do the same for Storefront. Launch my default browser. And already have me logged into WP admin. The script is available at that link. I'm going to walk you through it really quick. Because I'm a dits, and sometimes I forget how to use the stuff that I wrote. Like I can't remember what I had for lunch yesterday. So don't ask me what I was thinking when I wrote this thing six months ago. So I wrote a little function thing that tells me if I misuse the, if I type the command wrongly, it tells me exactly what it's expecting. And you'll see how that comes into play a little later. Now, I have comments everywhere because just so I can remember what it was I was thinking at this time. And what I'm doing there is I'm checking, if you call the WC site command with no other, you don't pass any variables to it. Then it will tell you you've done something wrong. And it will show you that first function, telling you this is how you do it, dummy. Now, if you pass only one variable to it, it will assume that you want to install WooCommerce from the WordPress.org plug-in repo. But sometimes I want to test the current master, because maybe the issue has been fixed in the master, but it hasn't been released because it's not time for the new version. So I added a switch. So if you say WC site, Brighton-master, it will then install from GitHub, the current master. Instead of using the current release plug-in. And this is a little small to see. But essentially, all it does is, because I wanted to be able to do this, regardless of where I'm in the terminal, I made this script executable, and I put it in a place where, when I run it, it knows what I need it to do. I don't have to go into the folder where it exists. So what it does is, regardless of where I am, it will go into my sites folder. It will run the valet command. It will take whatever name I pass. If I pass Brighton, that $1 will be Brighton. It will use the same name for the database, because by default, the valet command will add wp underscore before the name you pass. And I didn't want that, so I customized it. Once that's done, it makes sure that I'm in the right directory by going into that folder, installing WooCommerce, and activating it. Now, I have a variable there for Woo, which will be determined by whether you want the one from the repo or from GitHub. It will install stuff often and activate it. There's a WPCLI login companion plugin that I found. It will install that and activate it. That's the plugin that lets you generate the magic link. It will also set the permanent structure the way that I want it. And initially, I was going to just open the site. So you find that I commented that out. There's another option to open the wp admin, which would then require you to log in. I commented that out as well, but I left it in there in case anyone just wanted to know about it. But the last one there, it would log in using the username that I already set, because I know that the username is always going to be luminous. And then the dash launch would launch the site using that magic link. So I'm already logged in, and I end up in wp admin. And this is kind of what it looks like. So in this instance, I want to install WooCommerce from GitHub, not the current version that's in the .org repo. All of this, it'll do the regular installation of WordPress for us. And then it'll CD into that directory. Once the installation is done, it will install and activate WooCommerce, then install and activate Storefront. Because usually, what we want to do is make sure that WooCommerce is working correctly. One of the default themes is working correctly. And when we test the plug-in that you're working with, there are no issues. So you can see there that it's downloading from, it's downloading WooCommerce from GitHub, install and activate it, it's doing the same thing for Storefront. Then it installs the logging companion and generates that link. Now, ordinarily, if I didn't have the dash launch, it would just generate the link. If you click the link, it would launch wp admin already logged in. But with the launch there, and you say it says success magic link launched, it just opens whatever browser is your default browser and has you already logged in. Once that's done, the next thing would be I want to install the plug-in that they're having problems with. And instead of going into the menu, plug-ins, searching for it, and then downloading it, if I know the name of it, if I know the slug for it, I can just do that using the WPCLI. Now, I'm going to talk quickly about making your terminal experience a bit more interesting. And the first thing I want to talk about is ZSH. It's an extended born shell. So if you use the command line at all, by default, you'll be using bash. Some people have different preferences like fish. I like ZSH, primarily also because of omit ZSH, which is where all of the magic happens in there. That's a community-driven framework that helps you manage your ZSH configurations. And it comes with a lot of helpful functions, plug-ins, and themes. By default, you can use it in Linux and in Mac because it's the next thing. But Windows users also have a fork. But only if you're on Windows 10, because there's a way to run Linux in Windows 10 in the command line. And according to the developers, it'll make you shout omit ZSH. One of the things I really like about it is you can say goodbye to having to use CD to change directories. So here's a quick example. Like I say this all the time, I'm lazy, so I want to do the minimum amount of work possible. To change it into a directory, I just type the name of it. And that's it. So yeah, it's only three characters, CD and space. But that saves quite a bit. The next thing is there's a take command, which helps you create a directory and then CD into it automatically. And it will even create all the intermediate directories for you along the way. And I'll show you a quick demo of that as well. So if I say take sample, it creates the sample folder and goes into it. And if I say take one, two, three, it will create one, create two inside it, create three inside that, and then CD all the way into three. So if I run PWD, which is a present working directory, it shows you the whole path there. If you're a developer and you're doing anything with GitHub, there's a git plugin that comes with this. That makes things even easier. So you can run GCL instead of saying git clone. You can say gcmsg instead of git commit dash m to commit whatever code that you've just written. There's a cheat sheet there that you can go check out. There's some aliases for WPLI as well. So if you thought WP plugin install was cool, try WPPI. There's a few other things I'm just going to run through these quickly. So item two is just a terminal replacement that has a couple of cool features, like split panes, which I like to use. So if I'm working in two different things, instead of having to open multiple windows or multiple tabs, I can split the pane into two. In that one window, work in two different things. There's Z that lets you jump around. And it works based on something called free-sensee. So it looks at the folders you access most frequently and most recently. So if I say Z-sites, it goes directly to my site directory. That's quicker than remembering the full path and having to cd into it. And I like to use this called hub, which is from GitHub themselves. It's a wrapper for git that lets you do a few cool things. So for example, if I'm cloning something from my own repo on GitHub, I just put the name of the thing. So if I have a project called cool stuff, instead of git clone luminous cool stuff, I just say git clone cool stuff. Same thing for pulling something from a different repo as well. Last thing I'll talk about is called GitHub, and it lets you update multiple Git repositories. And it's smart enough to handle several remotes. I would recommend this course to anyone who's interested in figuring out how to make the command line less scary. It's free. It's by a Canadian guy called Westboss. And it covers the basics of CLI, item 2, ZSH, and Zish. And just a quick recap, we talked about setting up a local development environment that's really quick, and how we can make some magic with WP CLI, and then how we can supercharge our terminal experience. Thank you very much. Wow, thank you, luminous. Super techy information there. We have about seven or eight minutes before lunch. Are there any questions for luminous? You've knocked them out. Oh, a question over here. Mariette, please. It's a great talk. Would you consider doing a workshop on how to set that up on your machine in the future on time? Sorry? Would you consider doing a workshop on how to set? I'd be happy to do that. And around for the rest of the day, I'll be at the Jetpack booth. So find me. I'm happy to walk you through as well. Great. Thanks. You're welcome. I think there's a gentleman there who has a question. Brilliant talk. Thanks. Sorry I arrived late. So I missed how you set up that terminal. Is it just a few path parameters to get all those fancy graphics in the terminal? So that is from ZSH itself. Using the Omy ZSH package, the themes in there that let you do all sorts of really cool things. You can determine what kind of information you want showing on the terminal. The date, the version of node that you have installed, the version of RVM that you have installed, whether or not the last command was successful. So if you see a one in red, it means that it failed. If it's green, it means that it passed. How much of the current path you want to show? And even it supports inline images. So where, say, on my examples, you'd see OSX. You could have it show the Apple logo. If you're using Linux, you could have it show the Linux logo. If you were maybe logged into a certain server, you could have it show the logo for that if it's available. So I guess it does emojis, too. It supports emojis, yes. Wow, things have moved on a bit since the Vax. Well, thank you very much. If anyone has any questions or wants to ask anything or wants me to walk them through any of this, just find me. I'll be with my computer and I'll be able to show you whatever you need. Thank you very much. Thank you.