PHP code example of hampel / console-report

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

    

hampel / console-report example snippets


// Symfony Console, and XenForo add-on commands, which are Symfony commands
protected function execute(InputInterface $input, OutputInterface $output): int
{
    $this->setReportOutput($output);
    ...
}

// Laravel and Laravel Zero - an OutputStyle is an OutputInterface, so it goes straight in
public function handle(): int
{
    $this->setReportOutput($this->getOutput());
    ...
}

use Hampel\ConsoleReport\FormatsValues;
use Hampel\ConsoleReport\ReportsSettings;
use LaravelZero\Framework\Commands\Command;

class Config extends Command
{
    use FormatsValues;
    use ReportsSettings;

    protected $signature = 'app:config {--only= : The sections to display, comma separated}';

    public function handle(): int
    {
        $this->setReportOutput($this->getOutput());

        $this->reportSettings([
            'Application' => [
                'Version' => $this->app->version(),
                'Environment File' => $this->path($this->laravel->environmentFilePath()),
            ],

            'Backup' => [
                'Targets Path' => $this->path(config('backup.targets_path')),
                'Cloud Remote' => $this->

use Hampel\ConsoleReport\RendersChecks;
use Symfony\Component\Console\Command\Command;

class Validate extends Command
{
    use RendersChecks;

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $this->setReportOutput($output);

        $this->checkOk('rclone', '/usr/bin/rclone v1.60.1');
        $this->checkWarn('cloud remote', 'does not exist yet - it will be created on first transfer');
        $this->checkFail('mysqldump', 'not found on PATH');
        $this->checkSkip('sync', 'nothing configured');

        return $this->checkExitCode();
    }
}

$this->checkSection('Binaries');
$this->checkOk('rclone', '/usr/bin/rclone v1.60.1');
$this->checkFail('mysqldump', 'not found on PATH');

$this->checkSection('Cloud');
$this->checkOk('credentials', 'accepted');
$this->checkWarn('remote', 'does not exist yet');