Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aeno/php-slickprogress
Lightweight but beautiful PHP progress bars and spinners.
https://github.com/aeno/php-slickprogress
cli lightweight php progress-bar spinner
Last synced: about 1 month ago
JSON representation
Lightweight but beautiful PHP progress bars and spinners.
- Host: GitHub
- URL: https://github.com/aeno/php-slickprogress
- Owner: aeno
- License: mpl-2.0
- Created: 2021-06-16T20:00:57.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-06-17T11:21:21.000Z (over 3 years ago)
- Last Synced: 2024-11-22T12:17:17.369Z (about 2 months ago)
- Topics: cli, lightweight, php, progress-bar, spinner
- Language: PHP
- Homepage:
- Size: 126 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
php-slickprogress
Lightweight but beautiful PHP progress bars and spinners.
## No dependencies
* works with PHP 7.1+## Installation
```shell
composer require aeno/php-slickprogress
```## Usage
### Simple progress
![Simple progress output](docs/slick-simple.gif)
```php
$progress = new \Aeno\SlickProgress\Progress();
$progress->start(50);for ($i = 0; $i < 50; $i++) {
$progress->advance();
usleep(25000);
}$progress->finish();
```### Detailed progress
![Detailed progress output](docs/slick-detailed.gif)
```php
$theme = new \Aeno\SlickProgress\Theme\Simple();
$theme->showStep(true);
$theme->showPercent(true);$progress = new \Aeno\SlickProgress\Progress($theme);
$progress->start(200);for ($i = 0; $i < 200; $i++) {
$progress->advance();
usleep(25000);
}$progress->finish();
```### Indefinite progress
![Indefinite progress output](docs/slick-indefinite.gif)
```php
$progress = new \Aeno\SlickProgress\Progress();
$progress->start(-1);for ($i = 0; $i < 200; $i++) {
$progress->advance();
usleep(25000);
}$progress->finish();
```### Spinner
![Spinner output](docs/slick-spinner.gif)
```php
$foobar = new \Foobar(); // your business logic$theme = new \Aeno\SlickProgress\Theme\Snake();
$theme->setColorType(\Aeno\SlickProgress\Colors::COLOR_TYPE_ANSI256);$progress = new \Aeno\SlickProgress\Progress($theme);
$progress->start(-1);for ($i = 0; $i < 100; $i++) {
if ($foobar->hasNewStatus()) {
$progress->setStatusMessage($foobar->getCurrentStatus());
}$progress->advance();
usleep(50000);
}$progress->finish(\Aeno\SlickProgress\ThemeInterface::FINISH_TYPE_MESSAGE, '✅ Done!');
```## License
php-slickprogress is licensed under the [Mozilla Public License, v. 2.0](https://mozilla.org/MPL/2.0/).