PHP code example of herrera-io / go

1. Go to this page and download the library: Download herrera-io/go 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/ */

    

herrera-io / go example snippets




use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

// create our task
task(
    'hello',
    'Say hello',
    function (InputInterface $input, OutputInterface $output) {
        $output->writeln(
            sprintf(
                'Hello, %s%s',
                $input->getArgument('name'),
                $input->getOption('ending')
            )
        );
    }
);

// add an argument to the task
arg('name', ARG_IS_OPTIONAL, 'Your name', 'world');

// add an option to the task
option('ending', 'e', OPT_IS_OPTIONAL, 'How to end', '!');