What is Homestead in Laravel?
Laravel Homestead is an official, pre-packaged Vagrant virtual machine designed to provide a complete PHP development environment. It includes everything you need to develop Laravel applications without installing PHP, a web server, or other services on your local machine. Note that Homestead is a legacy package and Laravel Sail is the modern alternative.
Why Use Homestead?
- Provides a pre-configured development environment for Laravel projects.
- Runs consistently on Windows, macOS, or Linux.
- Includes Nginx, multiple PHP versions, MySQL, PostgreSQL, Redis, Memcached, Node, Docker, and more.
- Fully isolated, disposable, and easy to recreate with Vagrant.
- Supports advanced tools like Xdebug, Blackfire, Mailpit, Minio, and Laravel Dusk.
Without Homestead
Without Homestead, you would need to manually install and configure each service:
- Install PHP, Nginx/Apache, MySQL/PostgreSQL, Node.js, Composer, Redis, and other dependencies.
- Configure PHP versions, services, and environment variables manually.
- Debugging tools like Xdebug or Blackfire require separate setup.
- Sharing your local environment with team members is more complex.
Included Software in Homestead
- Ubuntu 22.04, Git, Composer
- PHP 5.6 – 8.3 (multiple versions available)
- Nginx, MySQL 8.0, PostgreSQL 15, SQLite3
- Redis, Memcached, Docker, Node (with Yarn, Bower, Gulp, Grunt)
- Mailpit, Beanstalkd, Xdebug, XHProf/Tideways/XHGui
Optional Software
You can enable optional services via Homestead.yaml features:
- Apache, Elasticsearch, MongoDB, MariaDB, Neo4j, Cassandra, CouchDB
- Grafana, InfluxDB, Logstash, MinIO, PM2, Python, R, RabbitMQ, Rust
- Laravel Dusk Webdriver, Oh My Zsh, Blackfire, RVM
Installation and Setup
- Install Vagrant and a supported provider (VirtualBox, Parallels).
- Clone the Homestead repository:
git clone https://github.com/laravel/homestead.git ~/Homestead cd ~/Homestead git checkout release - Create the configuration file:
# macOS / Linux bash init.sh # Windows init.bat - Edit
Homestead.yamlto configure shared folders, sites, databases, PHP versions, and services. - Launch the Vagrant box:
vagrant up
Configuring Homestead
1. Provider
Set the Vagrant provider in Homestead.yaml:
provider: virtualbox2. Shared Folders
Map your project directories to the virtual machine:
folders:
- map: ~/code/project1
to: /home/vagrant/project1
type: "nfs"3. Sites
Map domains to project folders:
sites:
- map: homestead.test
to: /home/vagrant/project1/public4. Environment Variables
variables:
- key: APP_ENV
value: local
- key: FOO
value: bar5. PHP Versions
Specify PHP version per site:
sites:
- map: homestead.test
to: /home/vagrant/project1/public
php: "8.1"6. Services
Enable or disable services:
services:
- enabled:
- "postgresql"
- disabled:
- "mysql"7. Ports
Forward additional ports if needed:
ports:
- send: 50000
to: 5000
- send: 7777
to: 777
protocol: udpAdvanced Usage
- SSH:
vagrant sshinto your Homestead machine. - Add multiple sites: Configure multiple Laravel projects on the same VM.
- Mailpit: Intercept emails locally at
http://localhost:8025. - Minio: Use S3-compatible storage locally.
- Laravel Dusk: Enable
webdriver: truefor browser testing. - Debugging: Use Xdebug or Blackfire for profiling.
- Extending: Add custom scripts via
after.shoruser-customizations.sh.
Daily Workflow
- SSH into the VM:
vagrant ssh - Access sites in browser via configured domains (e.g.,
http://homestead.test). - Run Laravel Artisan commands for each PHP version if needed.
- Forward ports or add new services as required.
Updating Homestead
- Destroy the current VM:
vagrant destroy - Pull the latest repository updates:
git fetch & git pull origin release - Update composer dependencies:
composer update - Update Vagrant box:
vagrant box update - Re-provision the VM:
vagrant up
Summary
Homestead provides a complete, consistent, and isolated Laravel development environment that works across operating systems. It includes multiple PHP versions, databases, caching tools, and developer utilities. Even though Homestead is a legacy package and Laravel Sail is now preferred, it remains a great way to set up a Laravel development environment quickly and reliably.
Related Answers
Still need help?
Talk to our Laravel experts
We've handled GDPR/CCPA compliance for dozens of EU & US Laravel.
