PHP CLI Spinner: Make the cursor spin in the command line shells

Recommend this page to a friend!
  Info   View files Example   View files View files (17)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2021-06-23 (2 months ago) RSS 2.0 feedNot enough user ratingsTotal: 56 All time: 10,006 This week: 181Up
Version License PHP version Categories
spinner 1.0.0Custom (specified...5PHP 5, Console
Description Author

This package can make the cursor spin in the command line shells.

It can start a parallel process that will change the character that appears in the current cursor position in the command-line shell to make it appear as an animated cursor.

The package provides theme classes that implement different styles of animations to be used as characters that appear spinning near the cursor.

Innovation Award
PHP Programming Innovation award nominee
June 2021
Number 3
Sometimes applications need to execute tasks that take a long time to finish. It is always good to provide feedback to the users to let them know what is happening, avoiding that the users become too anxious.

For console-based applications, usually, a cursor may appear blinking, but that does not give feedback on whether the current application is running well.

This package implements a better solution by showing the cursor changing its character, so it appears to be animated. This can give the users a better feeling by letting them know that the application is running.

The package implements a solution that uses a parallel process to animate the cursor character, so the application does not have to stop its main job to update the cursor animation.

Manuel Lemos
Picture of Isa Eken
  Performance   Level  
Name: Isa Eken <contact>
Classes: 11 packages by
Country: Turkey Turkey
Innovation award
Innovation award
Nominee: 7x

Details

PHP Spinner

> Elegant spinner for interactive CLI apps. > > Alternative for https://github.com/sindresorhus/elegant-spinner

Spinner

$result = \IsaEken\Spinner\Spinner::run(function () {
    \IsaEken\Spinner\Spinner::setTitle('Calculating...');
    $a = 1;
    $b = 2;
    $c = $a + $b;
    \IsaEken\Spinner\Spinner::setTitle('Waiting...');
    sleep($c);
    return $c;
});

echo "The result is: $result!";

Installation

You can install using composer.

composer require isaeken/spinner

License

The MIT License (MIT). Please see License File for more information.

  Files folder image Files  
File Role Description
Files folder imagebin (2 files)
Files folder imageexample (3 files)
Files folder imagesrc (4 files, 3 directories)
Plain text file composer.json Data Auxiliary data
Plain text file LICENSE.md Lic. License text
Plain text file README.md Doc. Documentation

  Files folder image Files  /  bin  
File Role Description
  Plain text file get_width.bat Data Auxiliary data
  Plain text file spin.php Example Example script

  Files folder image Files  /  example  
File Role Description
  Image file example.gif Data Auxiliary data
  Plain text file example.php Class Class source
  Plain text file spinner.yml Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imageEnums (2 files)
Files folder imageInterfaces (1 file)
Files folder imageThemes (2 files)
  Plain text file Helpers.php Class Class source
  Plain text file LockFile.php Class Class source
  Plain text file PhpProcess.php Class Class source
  Plain text file Spinner.php Class Class source

  Files folder image Files  /  src  /  Enums  
File Role Description
  Plain text file OperatingSystem.php Class Class source
  Plain text file Status.php Class Class source

  Files folder image Files  /  src  /  Interfaces  
File Role Description
  Plain text file ThemeInterface.php Class Class source

  Files folder image Files  /  src  /  Themes  
File Role Description
  Plain text file ClassicTheme.php Class Class source
  Plain text file DefaultTheme.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:56
This week:0
All time:10,006
This week:181Up
For more information send a message to info at phpclasses dot org.