laravel homestead with php 8.4 can it be done?

Updated: Mar 04, 2025

laravel homestead with php 8.4 can it be done?

Yes, you can use Laravel Homestead with PHP 8.4. Here are the steps to set it up:

  1. First, make sure you have the latest version of Homestead installed. You can check for updates by running the following command in your terminal:
cd ~/Homestead
git pull
  1. Next, update your Homestead.yaml file to use PHP 8.4. Open the file in your text editor and find the php key under the composer key. Change the value to php8.4. Here's an example:
composer:
    key: "-----BEGIN RSA PRIVATE KEY-----"
    repository: "https://packagist.org"
    require:
        - php: ^8.4
  1. Save the file and run the following command to update your Homestead box:
cd ~/Homestead
box update
  1. Once the box is updated, create a new Homestead environment for your Laravel project. Run the following command to create a new directory for your project and initialize a new Laravel installation:
mkdir myproject
cd myproject
composer init -y
  1. Next, add your project to your Homestead.yaml file. Open the file in your text editor and add the following lines under the sites key:
myproject:
    map: homestead.app
    to: /home/vagrant/myproject/public
  1. Save the file and add your project to your hosts file. Open the hosts file in your text editor (usually located at /etc/hosts) and add the following line:
192.168.10.10 myproject.app

Replace 192.168.10.10 with the IP address of your Homestead box.

  1. Finally, start your Homestead box and your Laravel project:
cd ~/Homestead
vagrant up
vagrant ssh

Once you're in the Homestead box, navigate to your project directory and run composer install to install your dependencies.

That's it! You now have Laravel Homestead set up with PHP 8.4.