PHP development - perfect workflow

Life of an Web Developer comes with a lot of challenges, some might be good to improve skills, some might keep you on hold from not working on what you should.

One of the challenges I had and never liked was configuring projects environment on several machines, from Windows to Mac OS X, for me or for my collegues, hours of lost time until I discovered Vagrant.

Vagrant works for development environments like composer works for PHP. Never was easier to configure the development server as you want on as many computers you need.

The trick comes when you will need to configure vagrant, but that is easier than you think. A search on github will give you plenty of already made configurations.

My favourite one is based on Ubuntu and you can check it on scotch-io/Vagrant-LAMP-Stack repository.

I am using Mac OS X Mavericks + Sublime3 + iTerm2 + Sequel Pro, but this should work on any other OS and tools. For any issue, add a comment.

Requirements (as on github repo)

Install new project

Now, just clone the repo in your Projects folder. If you don't have one, I suggest you create it. We will make a new project called test.

git clone test   
cd test

Open Vagrantfile under the root of test folder in your favourite editor and take a look on this lines:

9:   ip_address = "" # Leave it as it for now
-12:  project_name = "projectname" # Will change to test in our case
+12:  project_name = "test" # Will change to test in our case

We can let the other settings as they are, but I prefer my development projects to be accessible from instead of http://projectname.local. For this, let make a Find All ".local" and Replace All with ".dev".

You are set to go. Run from the root of the test folder:

vagrant up    

You may have to enter your sudo password once or twice in order to make the required changes to the hosting manager but either than that it should work like a charm and you will have a perfect environment running PHP5.4, Apache2.2 and MySQL5.5.

Check it out yourself

To connect with ssh to the VM use: vagrant ssh

I prefer not using phpmyadmin when I can use SequelPro (or SQL Community on Windows) and the connection to the database will be made also thru SSH. You will need to use the IP address in the Vagrantfile and the ssh key ~/.vagrant.d/insecure_private_key. Sequel Pro Configuration

For any suggestions, or questions feel free to use comment section or Contact page.

comments powered by Disqus