PHP code example of consoletvs / progresser

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

    

consoletvs / progresser example snippets


$progress = Progress::create();

// Control methods
$progress->start('Preparing information...');
$progress->step('Done task 1');
$progress->status('Now doing this...');
$progress->complete('Done task 2');
$progress->fail('Failed at task 2');

// Methods
$progress->isRunning();
$progress->hasFailed();
$progress->hasCompleted();
$progress->hasSteps();
$progress->percentage();

// Attributes
$progress->status;
$progress->current_step;
$progress->steps;
$progress->running;
$progress->failed;
$progress->failed_payload;
$progress->default_completed_status;
$progress->default_failed_status;

$progress = Progress::create();

$progress->start('Preparing information...');
$progress->step('Done task 1');
$progress->complete('Done task 2');

$progress = Progress::create();

$progress->start('Preparing information...', 2);
$progress->step('Done task 1');
$progress->step('Done task 2');

$progress = Progress::create();

$progress->start('Preparing information...');
$progress->step('Done task 1');
$progress->fail('Done task 2');

use Illuminate\Database\Eloquent\Model;
use ConsoleTVs\Progresser\Traits\Progressable;

class Book extends Model
{
    use Progressable;
}

$book = Book::create();
$progress = $book->progress('review');
$progress->start('Starting book review...');
$progress->complete('Finished review...');