Loading...

Wir freuen uns auf Ihre Nachricht

Die von Ihnen gesendete Nachricht wird selbstverständlich streng vertraulich behandelt. Wir melden uns dann so rasch wie möglich auf Ihr Anliegen.

Ihr Download steht bereit

Geben Sie uns bitte ein paar Infos zu Ihrer Person bekannt. Die Präsentation wird im Anschluss an die von Ihnen angegebene E-Mail-Adresse gesendet.

Local WordPress Development with Laravel Valet

WordPress & Valet. Simple & Fast.

valet bedrock driver
TOWA Mitarbeiter Sahin Ucar

Written By
Sahin Ucar


| 3 Minuten

There are tons of options for setting up a local development environment for WordPress. In this post we want to show you, how you can use Laravel Valet for local WordPress development.

Laravel Valet

Laravel Valet was primarily designed for local Laravel development – sounds obvious right? 🙂

Valet uses the built-in PHP server from Mac (yes Valet is limited to Mac-Users, but there are forks for Linux and Windows – but we did not test those yet) and utilizes DnsMasq to proxy all requests to the .test TLD to sites on your local machine. Valet also requires PHP and a database server installed locally on your machine.

Out of the box, Valet already supports numerous frameworks like Laravel, Lumen, Bedrock, Drupal, Symfony, WordPress and others. Additionally you can build custom drivers to support your own setup.

It’s a very simple and fast setup.

WordPress & Valet

We are using a slightly modified Bedrock setup for our WordPress projects, but you can also use the default one. The local setup is pretty easy and can be done as follows.

1. Install valet with composer

composer global require laravel/valet

Laravel Valet after Installation

2. Configure Valet

Run valet install for installing and configuring valet and dnsmasq. After the installation try pinging any *.test domain and you should see that 127.0.0.1 will respond.

Auto mapping projects

Valet has a super comfortable function, which maps local sites automatically to the configured TLD domain. For enabling it switch to the designated folder and run valet park.

▲ cd ~/projects/valet
▲ valet park

All folders inside the used path will be mapped automatically. The folder name is also the site name.

Valet Mapping configuration

3. Setup WordPress project

As usual 🙂

And that’s actually it.

Sharing sites

You can also share local sites to others with the valet share command. It enables sharing with a tool called ngrok.

▲ cd ~/projects/valet/towa-boilerplate
▲ valet share

After running the command inside the project folder, following screen appears:

valet sharing

Further useful commands

  • valet link: add projects outside the parked folder
  • valet secure: secure a local site with ssl
  • valet list: list all commands

Valet vs VMs

You should be aware that Valet is not a replacement for a virtual machine. If you need more advanced and extended setup you probably have to use one. Reasons for that would be for example if you need a flexible local environment without beeing tied to your local settings or if you wish to make a more production-like environment. Additionally some VMs provide other services and software you may need like Redis, Memcached, Node, Mailhog, Elasticsearch and so on.

You could use for example homestead – which we’ll cover in a separate blogpost.

Conclusion

Valet is a super simple and fast setup for a local development environment. It’s suitable for WordPress and also a couple of other frameworks who have the same requirement stack.

 

Resources