Creating a Laravel project in Homestead.

In this topic we will create a basic laravel project to test our newly configured Laravel Homestead development environment.

To start launch the Homestead Virtual Machine which was discussed in detail in our previous topic Launching the Homestead Virtual Machine.

Once the Homestead virtual machine is up and running, you can connect to it using SSH.

  1. Open Windows Terminal, and navigate to the Homestead directory.

cd /vm/Homestead
  1. In the terminal or command prompt, run the following command:

vagrant ssh

This command will connect you to the Homestead virtual machine.

  1. Run the following command to navigate to code directory:

cd code
  1. Then, run the following command to create a new Laravel project:

composer create-project --prefer-dist laravel/laravel mylaravelapp

The project name mylaravelapp is the project name we set in our previous topic Configuring Shared Folders.

  1. Please wait, this will install the dependencies for the new project.

Below shows that you have successfully a new laravel project.

Run the following command to navigate to the project directory:

cd mylaravelapp
  1. You can also directly check the project in the code directory we created in the previous topic Configuring Shared Folders.

  1. The application is now accessible to the hostname we configured in the Configuring Hostname Resolution topic.

  1. Your project will now open to your default browser.

  1. You can now open your project in the VS Code and start coding.

That's it! You have successfully created a Laravel project in Homestead and launched it on your local machine. You can now start developing your Laravel application using the Homestead virtual environment.

You can check to Laravel site for the detail of the documentation.

In the next topic, we will create a Laravel API project and test the API on Postman.

Last updated