Package Home

Zend Framework 2 Documentation (Manual)

PHK Home

File: /modules/zend.progress-bar.adapter.console.html

Size:9540
Storage flags:no_autoload,compress/gzip (34%)

Console Adapter — Zend Framework 2 2.4.2 documentation

Console AdapterΒΆ

Zend\ProgressBar\Adapter\Console is a text-based adapter for terminals. It can automatically detect terminal widths but supports custom widths as well. You can define which elements are displayed with the progressbar and as well customize the order of them. You can also define the style of the progressbar itself.

Note

Automatic console width recognition

shell_exec is required for this feature to work on *nix based systems. On windows, there is always a fixed terminal width of 80 character, so no recognition is required there.

You can set the adapter options either via the set* methods or give an array or a Zend\Config\Config instance with options as first parameter to the constructor. The available options are:

  • outputStream: A different output-stream, if you don’t want to stream to STDOUT. Can be any other stream like php://stderr or a path to a file.
  • width: Either an integer or the AUTO constant of Zend\Console\ProgressBar.
  • elements: Either NULL for default or an array with at least one of the following constants of Zend\Console\ProgressBar as value:
    • ELEMENT_PERCENT: The current value in percent.
    • ELEMENT_BAR: The visual bar which display the percentage.
    • ELEMENT_ETA: The automatic calculated ETA. This element is firstly displayed after five seconds, because in this time, it is not able to calculate accurate results.
    • ELEMENT_TEXT: An optional status message about the current process.
  • textWidth: Width in characters of the ELEMENT_TEXT element. Default is 20.
  • charset: Charset of the ELEMENT_TEXT element. Default is utf-8.
  • barLeftChar: A string which is used left-hand of the indicator in the progressbar.
  • barRightChar: A string which is used right-hand of the indicator in the progressbar.
  • barIndicatorChar: A string which is used for the indicator in the progressbar. This one can be empty.

This Page

Note: You need to stay logged into your GitHub account to contribute to the documentation.

Edit this document

Edit this document

The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.

  1. Login with your GitHub account.
  2. Go to Console Adapter on GitHub.
  3. Edit file contents using GitHub's text editor in your web browser
  4. Fill in the Commit message text box at the end of the page telling why you did the changes. Press Propose file change button next to it when done.
  5. On Send a pull request page you don't need to fill in text anymore. Just press Send pull request button.
  6. Your changes are now queued for review under project's Pull requests tab on GitHub.

For more information about the PHK package format: http://phk.tekwire.net