Download the PHP package vivait/symfony-console-promptable-options without Composer

On this page you can find all versions of the php package vivait/symfony-console-promptable-options. 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 symfony-console-promptable-options

Promptable Options for Symfony Console

Build Status

Compatibility / Requirements

Installation

composer require vivait/symfony-console-promptable-options

Usage

Configure the promptable options in the configure() method of your command.

You can call the $this->addPrompt(string $optionName, array $configuration = []) fluently with the other options to add a prompt for a single option.

Alternatively, call $this->addPrompts(array $options = []) fluently with the other options to add prompts for multiple options at the same time by providing a key value array of option names and their desired configurations. This does not over-write any previously added prompts, it adds them on to the options. Here's an example of adding multiple prompts:

Once configured, access options using $this->getConsoleOptionInput(string $optionName).

The table below shows how it acts in various situations:

Option marked as promptable Option not promptable
Option supplied via --optionName=value The value of --optionName=value will be returned The value of --optionName=value will be returned
Option not supplied via --optionName=value The option will be asked for via an interactive question null will be returned

Non-interactive commands:

If you run a command that has promptable options that are not supplied via --optionName=value then an \Exception will be thrown with the message: "Cannot prompt for optionName, command is running in non-interactive mode"

Example command:

Output

When no options are specified - promptable options are asked for, and non-promptable options are still optional:

When some options are specified - promptable options are asked for:

When all options are specified - nothing is prompted for input:

When some options are not specified and the command is run with --no-interaction - when an option not specified is asked for, the command errors:

Option configuration

The following configuration options are available per option:

Configuration value Description Allowed values
type The type of value to be expected (input will be transformed) int, integer, float, bool, boolean, string (written as strings)
description The description for the option/the text to be displayed when asking for the option anything
required Whether or not the option is required. If it's set to true, then a value MUST be entered and they will be prompted until one is provided. If set to false, a default value will be used if set, or null will be returned as their input. true or false (as boolean)
default The default value to use if one is not provided (if not required) anything

Contributing

This started as a project internally that we used on some of our projects, if there's new features / ideas you think could be useful please feel free to suggest them, or submit a PR!

Although this project is small, openness and inclusivity are taken seriously. To that end the following code of conduct has been adopted.

Contributor Code of Conduct


All versions of symfony-console-promptable-options with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
symfony/console Version ^2.8|^3.0
symfony/options-resolver Version ^3.2
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 vivait/symfony-console-promptable-options contains the following files

Loading the files please wait ....