PHP code example of fenzland / cli
1. Go to this page and download the library: Download fenzland/cli library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fenzland / cli example snippets
class FooCmd extends \Fenzland\CLI\ACmd
{
protected function main( \Fenzland\CLI\IArgs$args ):int
{
# TODO code of your command.
}
}
#!/usr/bin/env php
$cmd->run( $argv ) );
#!/usr/bin/env php
App;
$app->regCmd( 'foo', FooCmd::class );
$app->regCmd( 'bar', BarCmd::class );
# ...
exit( $app->run( $argv ) );
bash
vim foo.php
bash
chmod +x foo.php
bash
vim app.php
bash
chmod +x app.php