Giter VIP home page Giter VIP logo

php-console-spinner's Introduction

Logo

Spinner - your task is running

🏵️ PHP Console Spinner

PHP Version Build Status Appveyor Status Scrutinizer Code Quality Code Coverage Total Downloads

Latest Stable Version Packagist Pre Release Version Latest Unstable Version

License Average time to resolve an issue Percentage of issues still open

advanced

⚠️ Compatibility issues

Update 2019-Nov-01: As of version 0.53 compatibility issues should be resolved, but it needs to be tested.

This project is still in its active development phase. It turned out that some of its indirect dependencies are causing compatibility issues. New release is expected to be ready in mid-november 2019. For now, as a solution, you can use lightweight spinner alecrabbit/php-cli-snake.

Feature comparision

Feature php-console-spinner php-cli-snake
Lightweight ❌ ️ ✔️
Has zero dependencies ❌ ️ ✔️
Highly configurable ✔️ ️
Contains various spinner classes ✔️ ️
Progress indicator ✔️ ️
Messages indicator ✔️ ️
Color settings for spinner ✔️ ️
Color settings for messages ✔️ ️
Color settings for progress indicator ✔️ ️
Has disable() method ✔️ ️
Has enable() method ✔️ ️
Can show final message ✔️ ️
Cursor hide can be disabled ✔️ ️
Can use optional custom output ✔️ ️
Has erase() method ✔️ ️ ✔️ ️
Hides cursor with $spinner->begin() ✔️ ️ ✔️ ️
Shows cursor with $spinner->end() ✔️ ️ ✔️ ️
Supports piping ✔️ ️ ✔️ ️
Supports redirect ✔️ ️ ✔️ ️
Supports no color mode ✔️ ️ ✔️ ️
Supports 16 color mode ✔️ ️ ✔️ ️
Supports 256 color mode ✔️ ️ ✔️ ️

Features

  • progress indication during spin $spinner->progress(0.5)50%
  • messages during spin $spinner->message('message')
  • separated color settings for spinner, messages and progress indicator
  • has disable() and enable() methods
  • hides cursor on $spinner->begin(), shows on $spinner->end()
  • cursor hide can be disabled $settings->setHideCursor(false)
  • has erase() method
  • final message $spinner->end('final message')
  • supports unix pipe | and redirect > output
  • supplied with SymfonyOutputAdapter::class

Quickstart

Simple

See simple.php

require_once __DIR__ . '/vendor/autoload.php';

use AlecRabbit\Spinner\SnakeSpinner;

const ITERATIONS = 50;

$spinner = new SnakeSpinner();

$spinner->begin();
for ($i = 0; $i <= ITERATIONS; $i++) {
    usleep(80000); // Simulating work
    $spinner->spin();
}
$spinner->end();

Advanced (ReactPHP)

See advanced.php, async.demo.php

require_once __DIR__ . '/../vendor/autoload.php';

use AlecRabbit\Spinner\BlockSpinner;
use React\EventLoop\Factory;

$s = new BlockSpinner();

$loop = Factory::create();

$loop->addPeriodicTimer($s->interval(), static function () use ($s) {
    $s->spin();
});

$s->begin();

$loop->run();

Installation

composer require alecrabbit/php-console-spinner

Usage

Spinners

Here you can find a list of all spinners with demos

Operating Systems

  • Developed and tested on Ubuntu 18.04 (xterm terminal)

  • On Windows it should work in any VT100 terminal, e.g. minTTY.

Links

php-console-spinner's People

Contributors

alecrabbit avatar dependabot-preview[bot] avatar nikolaymurha avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.