Speed up virtualhost creation with Deven

Deven stands for Development Environment or Development Engine. It’s a command line tool for web developers for creating LAMP virtualhost based development environments in a single command. It’s designed to run in Debian based environments, but could easily be converted to work on other operating systems too. If revised for security, Deven could as well be used for creating production environments. You are free to fork Deven on Github if you will. Merge requests are more than welcome!

In one of my previous posts, I have been writing about how to create a working virtualhost on your localhost. The purpose of Deven is to do all this in one simple command:

deven mydomain.local

.

Increase productivity: skip the boring stuff

We naturally tend to avoid the boring stuff, so before using Deven, I was always trying to install all the test scripts and projects as subdirectories under localhost. The problem is, it doesn’t allways work, and sometimes it works but with different results. So many times, I had to relocate my files and tweak config files later, which was even more boring.

Since it’s just a bunch of commands to be executed, why not put them into a script once and for all, and let the script do the boring stuff? I’m not verry keen on bash scripting, so I chose to write Deven in php.
Here’s what Deven does for you by now:

  • it creates a basic directory structure for your project
  • it creates the index.php file displaying phpinfo in the server root path
  • it creates the apache configuration file for your virtualhost under the sites-available/ directory
  • it adds your domain to the /etc/hosts file
  • it enables the site in apache (a2ensite)
  • and finally it reloads apache so the new changes take effect

From the above, you can understand why you need to be sudo to run Deven.

Right after executing sudo deven mydomain.local, you can visit http://mydomain.local in your browser and you will see your phpinfo. It’s as simple as that.

Installation

Deven is hosted on github, so you can simply clone or download and unpack the zip file.

git clone https://github.com/gresakg/deven.git
cd deven/
chmod +x deven.php
sudo ln -s /path/to/deven.php /usr/local/bin/deven 

Deven is not self a phar archive or self contained like composer so it still depends on the installation directory, where the configuration is held. This is subject to change in favor of a more standard solution.

I will give more insights and details about options in a follow-up post.