Drupal + Laravel Valet

  • Posted on: 27 November 2018
  • By: stillfinder

Valet is a Laravel development environment for Mac minimalists. No Vagrant, no /etc/hosts file. You can even share your sites publicly using local tunnels. Out of the box, Valet supports Drupal. So, lets setup Valet and Drupal.

Configure Valet

  1. Clone/install your Drupal project into the Valet sites directory.
  2. Create LocalValetDriver.php with the next content:
  3. Change possibleSubdirectories() function according to your preferences.
  4. Profit!

Change the domain

If you would like to change the URL of the site, you need to add the next line to your /etc/hosts file:
127.0.0.1 my-new-url.com

Then, create a symbolic link with the domain
ln -s my-project-folder my-new-url.com

Issues

A problem with $_GET['q'], 'q' query parameter, clean URLs

You need to check the frontControllerPath function from the LocalValetDriver.php:

For example, if you are expecting a problem with '?q' parameter while requesting the /jsonapi/some-page path, the following quick and dirty hack can be used: