WordPress on Valet

According to Laravel’s documentation, Valet is a Laravel development environment for Mac minimalists. I usually use XAMPP or MAMP. Also there are Vagrant, Homestead, etc. But I never use it. When using XAMPP or MAMP, accessing web directory via browser by typing locahost/{directory} (which is ugly). If with Valet {directory}.dev is enough. Simple. By default WordPress already supported by Valet.

OK let’s do this :

  1. Install Composer.
  2. Install or update Homebrew.
  3. Install PHP 7.1 using Homebrew brew install homebrew/php/php71
  4. Install Valet via Composer composer global require laravel/valet.
  5. Run valet install command.

Try pinging *.dev. If Valet installed correctly there will be respond from

Install database by running brew install mariadb. And run the service by running brew services start mariadb. You can connect to database at using root user with empty password.

Let say I have WordPress directory called henshin located under code/ directory. Go to code/ directory and run valet park. That’s it. Now you can access it by typing henshin.dev in your browser and do the installation.

There is another, you can share your site without uploading to any server (which is awesome). Valet will create a tunnel bla bla bla (you can read it in another source). TL;DR run valet share in your WordPress directory.

Copy the url and share it. As long as you not press CTRL+C everyone can access your site. But there is a problem when using Valet for WordPress. Because WordPress save the url in database, so when people click a menu (link to another page) it will go to henshin.dev/page not the url produced by ngrok. But other than that, no problem.

Ok that’s all about it.