DEV Community

Cover image for Laravel Homestead Vs Valet
Jonathon Ringeisen
Jonathon Ringeisen

Posted on

Laravel Homestead Vs Valet

Intro

When I first started programming I started with Laravel Homestead and thought it was amazing, and it was. But I eventually switched to Laravel Valet and it was a game-changer. Using Homestead simplified running my Laravel environment on my local machine, but Valet took it a few steps further which is why I switched.

What is Laravel Homestead?

Here it is straight out of the Laravel Documentation.

Laravel Homestead is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine. No more worrying about messing up your operating system! Vagrant boxes are completely disposable. If something goes wrong, you can destroy and re-create the box in minutes!

<?php

/**
 * Pros and cons of using Laravel Homestead
 */

$pros = [
    'Comes with PHP & a web server.',
    'It runs on a virtual machine, which can be destroyed if something goes wrong.',
    'It runs on Windows, Mac, or Linux'
];

$cons = [
    'You have to boot up a virtual machine each time you need to run the development site.',
    'You have to manage the configuration through a YAML file',
    'Anytime you start a new project you have to add the config details'
];
Enter fullscreen mode Exit fullscreen mode

What is Laravel Valet?

Here it is straight from the Laravel Documentation.

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. Yeah, we like it too.

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

<?php
/**
 * Pros and cons of using Laravel Homestead
 */

$pros = [
    'No configuration after initial setup.',
    'Can run localhost on https.',
    'Can use ngrok to share development site publicly.'
];

$cons = [
    'It runs on your machine',
    'Only supports mac.',
    'You have to manually install the database and PHP.'
];
Enter fullscreen mode Exit fullscreen mode

Why I chose Laravel Valet over Homestead.

I don't like being stagnant when it comes to technology, meaning I like constantly trying new things. That's why I gave Laravel Valet a try. Setup for both takes about the same amount of time but once you setup Valet there is no more configuration, unlike with Homestead.

For example, with Valet when you add a new project to your directory it's automatically configured to work. Meaning, if I add my-project to my www folder I can go to my browser and enter my-project.test and it works. With Homestead, you have to go into your YAML configuration and configure your new project to work before you can pull it up in your browser.

Conclusion

You can't go wrong using either Homestead or Valet, it comes down to preference. For me, Valet helps speed up my workflow allowing me to focus more on what matters which is programming, not setup.

Top comments (0)