ben tedder : code issues

Installing Laravel with a Homestead vagrant box

So turns out that installing Laravel on your machine is actually not too bad. The tricky bits come if you're using MAMP for your php setup. I've found it's easier to use an alternative php location for my laravel apps. I brew install php56 and brew install php56-mcrypt (separately).

Even though I have php 5.6 and mcrypt installed, I still haven't been able to run composer install on my local version of my laravel app and have it work. However, by installing homestead and getting that up and running, I am able to ssh in and run composer install on my shared from folder. Then I can navigate to my site (http://mysite.app:8000) and start developing on it.

A few points to remember:

  • Setup your /etc/hosts file to point 127.0.0.1 to mysite.app (or something similar)
  • Clone and work with homestead from your home directory (~/homestead)
  • Once you've edited the homestead.yaml file, run vagrant up and then navigate to http://mysite.app:8000 to see the "You have arrived" screen.

Homestead is great because you don't need to have your system setup with all the exact specs used for laravel. You can simply have a vagrant box that comes pre-setup.

Next steps: figuring out how to take the idea of homestead (a pre-fabbed VM ready for laravel) and see if there's a cookbook / droplet / instance template out there for easy server configuration and deployment. Comments and suggestions welcome!