Few months ago, i released a command line tool that allows developers create virtual hosts in seconds. I have few mails from developers who say the project is quite helpful. Unfortunately, the first release only included support for apache servers.
Today, i have released a new version that includes support for nginx servers.
New Features
- Support for Creating Nginx Server Blocks
While creating your virtual hosts, you can now specify which server you are creating for with a simple --server=nginx
switch. For example;
./vhost new:site --server=nginx
.
If you do not specify the --server
switch, apache will be used instead.
Every other thing works the same. It's really simple to use.
- How did you implement it/them?
The most important thing to note is that, each command is implementing an interface that is sort of a contract for how the sites should be created.
<?php
namespace therealsmat\contracts;
interface SiteInterface {
public function template($site_name, $domain_dir, $public_dir);
public function createSite($site_name, $domain_dir, $public_dir);
public function addToHosts($site);
}
All create commands implement this contract and define their own methods. It sounds really simple, but it's a lot going on behind.
Commits
https://github.com/therealSMAT/vhost-manager/commit/cdd66f108aa6a3ba221894c8588e982f38e4023c
https://github.com/therealSMAT/vhost-manager/commit/8836cbfa5c59c57dc14e472dc8059a224fa38fd9
https://github.com/therealSMAT/vhost-manager/commit/2dee6c23bf84758e791674263d348416ffa03aba
https://github.com/therealSMAT/vhost-manager/commit/7cb7d9737ac36ba7b07b127c2d399f39c4139837
Contributing
To contribute to this project, please send me a mail at me@tosinsoremekun.com.
Posted on Utopian.io - Rewarding Open Source Contributors