Develop a Simple Installer for Kebab Project on PHP CLI
In this post i’m going to explain how to write a simple installer for Kebab Project. Above codes and informations are trials and i am writing them right now. So don’t use them in really life. :) First of all we should understand PHP CLI. So it is a good idea to quick look
Now we create a menu because developer want to choices what to install. showMenu function echo a menu with 4 choice.
12345678
function showMenu(){ echo "What do you install?\n" . "1. Kebab \n" . "2. Doctrine \n" . "3. Zend Framework \n" . "4. ExtJs \n";}
Now we need to access the user input all we need to do is read from stdin. getLine function is accessed the input and trimed.
12345
function getLine(){ $handle = fopen ("php://stdin","r"); return trim(fgets($handle));}
Now we do action here. I mean get the user choice and install what they want to. But this is an other post issue thats why i just wanna echo a sentence what they wanna install.