It’s easy an I’m sure you would have figured it out on your own with the information already given, but I like the site to be complete and who doesn’t like a good walkthrough!
Let’s add a project surprisingly called ‘project2’.
My projectcode is on GitHub. Clone the new project in our ‘Code’ directory. From the terminal:
$ git clone https://github.com/OrganisationName/project2 ~/Code/project2
Add it to our homestead config:
$ cd ~/Homestead
$ vagrant halt
$ vi Homestead.yaml
Add your new project:
- map: ~/Code
- map: projectname.test
- map: project2.test
As you can see, it’s a piece of cake to specify and use next to each other different PHP versions for different projects.
Get your new config active and SSH into your box:
$ vagrant up --provision
$ vagrant ssh
Add a new database via Sequel Pro to your homestead box in the dev_project2 fashion. Import your test or acc database to it when your have this, or else create a new database from scratch. When URLs are hard coded in the database, change them to your local URL like http://project2.test.
Finally, don’t forget to add these database credentials to the file you normally use to store these, such as .env, db.php, wp-config.php, etc.
Add your site to your hosts file, via terminal, Gas Mask, or whatever:
You can now browse to http://project2.test.
Often the project needs some extra config or modules, as discussed before. From your homestead box:
$ cd /home/vagrant/code/project2
$ composer install
It varies per project what you’ll need, but you’ll now of course. Just don’t forget it.
So its this easy to add another project to your local development environment.