https://github.com/troublete/php-load
CLI progress indicator for PHP. ⏳
https://github.com/troublete/php-load
cli help-wanted loading loading-animations php php7
Last synced: 5 months ago
JSON representation
CLI progress indicator for PHP. ⏳
- Host: GitHub
- URL: https://github.com/troublete/php-load
- Owner: troublete
- License: gpl-2.0
- Created: 2017-10-16T19:15:49.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-17T18:12:52.000Z (over 7 years ago)
- Last Synced: 2024-12-11T18:18:52.632Z (5 months ago)
- Topics: cli, help-wanted, loading, loading-animations, php, php7
- Language: PHP
- Homepage:
- Size: 28.3 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# load

> CLI progress indicator for PHP.[](https://travis-ci.org/troublete/load)
## Install
```bash
$ composer require troublete/load
```## Usage
```php
ℹ️ see function `loop()`### spinner($checkClosure, $doneText)
Will run an indicator with an rotating bar.
#### Arguments
> ℹ️ see function `loop()`
### emoji($checkClosure, $doneText)
Will run an indicator with some emoji hearts.
#### Arguments
> ℹ️ see function `loop()`
### sphere($checkClosure, $doneText)
Will run an indicator with an pulsating sphere.
#### Arguments
> ℹ️ see function `loop()`
### loop($frames, $checkClosure, $doneText)
Will run an indicator with frames given.
#### 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. |## Related Packages
* [Cli](https://github.com/troublete/cli) - It's like meow, but for PHP.
* [Crayon](https://github.com/troublete/crayon) - A simple functional PHP library for formatting string output.## License
GPL-2.0 © Willi Eßer