2017 © Pedro Peláez
 

library load

CLI progress indicator for PHP.

image

troublete/load

CLI progress indicator for PHP.

  • Tuesday, October 17, 2017
  • by troublete
  • Repository
  • 1 Watchers
  • 0 Stars
  • 100 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 1 % Grown

The README.md

load

loading, (*1)

CLI progress indicator for PHP., (*2)

Build Status, (*3)

Install

$ composer require troublete/load

Usage

<?php
require_once 'path/to/vendor/autoload.php';

use function Load\dots;

$current = 0;
dots(function () use (&$current) {          
    $current++;
    if ($current == 100) {
        return true;
    }
    return "$current%";
}, '✔ done.');

API

Functions

dots($checkClosure, $doneText)

Will run an indicator with dots., (*4)

Arguments

ℹ️ see function loop(), (*5)

spinner($checkClosure, $doneText)

Will run an indicator with an rotating bar., (*6)

Arguments

ℹ️ see function loop(), (*7)

emoji($checkClosure, $doneText)

Will run an indicator with some emoji hearts., (*8)

Arguments

ℹ️ see function loop(), (*9)

sphere($checkClosure, $doneText)

Will run an indicator with an pulsating sphere., (*10)

Arguments

ℹ️ see function loop(), (*11)

loop($frames, $checkClosure, $doneText)

Will run an indicator with frames given., (*12)

Arguments

Argument Type Description
$frames array Loopable frames of the loading animation in the best case all with same character length so the animation seems fluid.
$checkClosure callable A callable structure, that will get called in any tick of the loading spinner (frame call) to check if loading is done. If the function returns a string or numeric value, the value will get passed as text output to the right side of the loading indicator. If the return value is true the doneText will be rendered instead of the loading indicator (plus any message beside it). If the return value is false an fatal error will be triggered.
$doneText string A text that will be displayed if the $checkClosure returned true.
  • Cli - It's like meow, but for PHP.
  • Crayon - A simple functional PHP library for formatting string output.

License

GPL-2.0 © Willi Eßer, (*13)

The Versions

17/10 2017

dev-master

9999999-dev

CLI progress indicator for PHP.

  Sources   Download

GPL-2.0

The Requires

  • php >=7.0

 

The Development Requires

by Willi Eßer

17/10 2017

1.0.0

1.0.0.0

CLI progress indicator for PHP.

  Sources   Download

GPL-2.0

The Requires

  • php >=7.0

 

The Development Requires

by Willi Eßer

17/10 2017

0.1.0

0.1.0.0

CLI progress indicator for PHP.

  Sources   Download

GPL-2.0

The Requires

  • php >=7.0

 

The Development Requires

by Willi Eßer