PHP code example of davahome / console

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

    

davahome / console example snippets


use DavaHome\Console\Command\AbstractCommand;

// Enable/Disable commands dynamically
public function configure()
{
  $this->setName('example')
    ->setEnabled(true);
}

// Ask questions
public function interact()
{
  $this->getQuestionHelper()->ask(new Question('What? '));
}

// Write to the error output
public function execute()
{
    $this->getErrorOutput($output)->writeln('This will be sent directly to STDERR (if supported)');
}

// Display progressBars
public function execute()
{
  $progressBar = $this->createProgressBar($output);
}

// Display tables
public function execute()
{
  $table = $this->createTable($output);
}

use DavaHome\Console\Helper\ProgressBarOptions;

// Use constants for defining the format
$progressBar->setFormat(ProgressBarOptions::FORMAT_DEBUG_NOMAX);

use DavaHome\Console\Helper\TableOptions;

// Use constants for defining the style
$progressBar->setFormat(TableOptions::STYLE_COMPACT);