Create a local development environment – Part 2

developmentLast post we’ve setup the basic of our local development environment. If any of the mentioned software is new to you, I recommend reading up a bit on it to get a better feel of what does what exactly.

Since our company uses the Laravel framework, Homestead is the obvious choice for the local development environment. Mind you though, that this is certainly not the only option you have. There are many, many to choose from. Start your search here if you like.

Anyway, let’s set up your first project.

The last command of our previous post, bash, created the Homestead.yaml file, which we’re using for all our configuration. Let’s set it up like below:

ip: ""
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/

- ~/.ssh/id_rsa

- map: ~/Code
to: /home/vagrant/code

- map: projectname.test
to: /home/vagrant/code/projectname/public
php: "7.2"

- homestead

Now we can provision the box and SSH into it:

$ cd ~/Homestead
$ vagrant up --provision
$ vagrant ssh


Homestead uses its own database where we can add all our testing databases. When the homestead box is running, add the databases to Sequel Pro:

  • Host:
  • Username: homestead
  • Password: secret
  • Port: 33060

Test and login. Add a database in the dev_projectname fashion and import your test or acc database to it. If your don’t have such an environment, you can of course just create a new database.

Note with existing databases: when URLs are hard coded in the database, change them to your local URL like http://projectname.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.

Test development environment

Add your site to your hosts file, via terminal, Gas Mask, or whatever: projectname.test

You can now browse to http://projectname.test.

Often the project needs some extra config or modules. From your homestead box:

$ cd /home/vagrant/code/projectname
$ npm install
$ gulp

It varies per project what you’ll need, but you’ll now of course. Just don’t forget it.

After every edit to your Homestead.yaml you should re-provision your boxes:

$ cd ~/Homestead
$ vagrant halt
$ vagrant up --provision

Surf to http://projectname.test again to see your changes (when applicable).

Complete series: part 1 and part 2. Plus a little addendum.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.