Implement CLI application by editing Main.php.
You may add new files to keep your code clean, if it is allowed in your challenge.
You can get commandline arguments as $argv
and also can get count of the $argv
by $args
in Main.php file where run
method is defined.
<?php
function run ($argc, $argv)
{
// code to run
}
$argc
and $argv
in this method came from $argc and $argv without script name information, passed in index.php. Although it has same variable name, please be careful that $argc
and $argv
in run
method does not connected to the arguments linked in above.
You can use print
functions in order to print your result into sdtout.
printf("%s\n", args);
If you want to use external libraries, do the following:
- Add dependency information in composer.json