Download the PHP package sumpygump/qi-console without Composer

On this page you can find all versions of the php package sumpygump/qi-console. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package qi-console

Qi Console

Qi Console provides PHP library classes for dealing with the console or terminal.

Build Status

Installation with Composer

Use composer to include the Qi_Console library in a project.

Add the following composer.json file to your project directory:

Then run composer install to fetch.

$ composer.phar install

If you don't have composer already installed, this is my recommendation for installing it. See getcomposer.org installation instructions.

Once the files have been composed with the composer install command, you can use any of the Qi_Console_ classes after composer's autoloader is included.

Manual Installation

You can also download the files and place them in a library folder. If you do this, be sure to update your autoloader to handle the Qi_Console_* classes or else manually include the files of the classes you'll need.

Documentation

ArgV

ArgV provides a way to assign and gather command line arguments

It will parse and assign option flags and arguments passed in as command line arguments

Examples of script arguments it can potentially parse:

Usage

The constructor takes two arguments: $argv and $rules

The argument $argv is an array of arguments from the command line that is parsed by PHP when the script is invoked. For example, when you invoke a PHP script with the following:

php myscript.php -v --flag --param=value okay

Then in your script PHP will provide a variable $argv representative of the elements of the arguments passed in as an array like this:

The argument $rules is a definition of options and help messages. The format is a key value array where the key is the option definition (possible parameters) and the value is the help message for that option.

Here are some examples illustrating the possible rules keys:

Here is some example code that illustrates the above:

Note that any additional options that were not defined in the rules array, but were passed in as input will result in sensible defaults, so options will default to true and named options (--anothername=value) will result in the values passed in ($arguments->anothername == 'value'). Additional non-option arguments will be available as $arguments->__arg2, $arguments->__arg3, etc.

Client

The Qi_Console_Client class provides a base console client that can be used to create command line clients. It takes input as $argv and a Terminal object which can be used to output messages back to the terminal.

Methods:

__construct()
_displayError()
_displayMessage()
_displayWarning()
_halt()
_resetTty()
_safeExit()
init()

Basic Usage

ExceptionHandler

The exception handler provides a way to handle exceptions from your console application. It uses the Terminal object to output pretty messages.

Menu

Qi_Console_Menu provides a way to prompt a user with a menu and receive input. Please see the code for documentation.

ProgressBar

Qi_Console_ProgressBar provides the ability to display a progress bar in the terminal. Please see the code for documentation.

Std

Qi_Console_Std is a wrapper for stdin, stdout and stderr.

This class provides methods for sending and receiving input from stdin and output to stdout and stderr.

Tabular

Qi_Console_Tabular generates ascii tables for displaying tabular data.

This will output the following table:

+--------------------------------------+
|  Name     |  Age  |  Favorite Color  |
+--------------------------------------+
|  John     |   28  |  Green           |
|  Hannah   |    7  |  Violet          |
|  Michael  |   43  |  Red             |
+--------------------------------------+

Terminal and Terminfo

Qi_Console_Terminal is a wrapper for Qi_Console_Terminfo which uses the UNIX terminfo mapping database to provide functionality for outputting escape sequences to the terminal. It provides a low-level robust way using terminal features such as outputting colors.

For more information about terminfo, check out these resources:

Basic Usage


All versions of qi-console with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sumpygump/qi-console contains the following files

Loading the files please wait ....