PHP code example of heartsentwined / zf2-cli

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

    

heartsentwined / zf2-cli example snippets


$cli = $locator->get('cli');
$cli = $locator->get('Yalesov\Cli\Cli');

$cli = new \Yalesov\Cli\Cli;

$cli->addTemplate('section', array(
  'template' => '## %s ##',
  'color'    => 'BLUE',
));

return array(
  'di' => array(
    'instance' => array(
      'alias' => array(
        'cli' => 'Yalesov\Cli\Cli',
      ),
      'cli' => array(
        'parameters' => array(
          'templates' => array (
            'section' => array(
              'template' => '## %s ##',
              'color'    => 'YELLOW',
            ),
            'task' => array (
              'template' => '- %s -',
              'color'    => 'BLUE',
            ),
            'module' => array(
              'template' => '[ %s ]',
              'color'    => 'GREEN',
            ),
          ),
        ),
      ),
    ),
  ),
);

$cli->write('foo', 'section');

$string = $cli->write('foo', 'section', false);