trait Illuminate / Console / Concerns / InteractsWithIO

InteractsWithIO

Properties

protected

$components Factory

The console components factory.

Default: null
protected

$input Symfony\...\InputInterface

The input interface implementation.

Default: null
protected

$output OutputStyle

The output interface implementation.

Default: null
protected

$verbosity int

The default verbosity of output commands.

Default: VERBOSITY_NORMAL
protected

$verbosityMap array

The mapping between human readable verbosity levels and Symfony's OutputInterface.

Default: array

Methods

public

hasArgument ( $name ) : bool

Determine if the given argument is present.

Parameters

  • $name string|int
public

argument ( $key ) : array|string|bool|null

Get the value of a command argument.

Parameters

  • $key string|null
public

arguments ( ) : array

Get all of the arguments passed to the command.

public

hasOption ( $name ) : bool

Determine if the given option is present.

Parameters

  • $name string
public

option ( $key ) : string|array|bool|null

Get the value of a command option.

Parameters

  • $key string|null
public

options ( ) : array

Get all of the options passed to the command.

public

confirm ( $question , $default ) : bool

Confirm a question with the user.

Parameters

  • $question string
  • $default bool
public

ask ( $question , $default ) : mixed

Prompt the user for input.

Parameters

  • $question string
  • $default string|null
public

anticipate ( $question , $choices , $default ) : mixed

Prompt the user for input with auto completion.

Parameters

  • $question string
  • $choices array|callable
  • $default string|null
public

askWithCompletion ( $question , $choices , $default ) : mixed

Prompt the user for input with auto completion.

Parameters

  • $question string
  • $choices array|callable
  • $default string|null
public

secret ( $question , $fallback ) : mixed

Prompt the user for input but hide the answer from the console.

Parameters

  • $question string
  • $fallback bool
public

choice ( $question , array $choices , $default , $attempts , $multiple ) : string|array

Give the user a single choice from an array of answers.

Parameters

  • $question string
  • $choices array
  • $default string|int|null
  • $attempts mixed|null
  • $multiple bool
public

table ( $headers , $rows , $tableStyle , array $columnStyles ) : void

Format input to textual table.

Parameters

  • $headers array
  • $rows Illuminate\...\Arrayable|array
  • $tableStyle Symfony\...\TableStyle|string
  • $columnStyles array
public

withProgressBar ( $totalSteps , Closure $callback ) : mixed|void

Execute a given callback while advancing a progress bar.

Parameters

  • $totalSteps iterable|int
  • $callback Closure
public

info ( $string , $verbosity ) : void

Write a string as information output.

Parameters

  • $string string
  • $verbosity int|string|null
public

line ( $string , $style , $verbosity ) : void

Write a string as standard output.

Parameters

  • $string string
  • $style string|null
  • $verbosity int|string|null
public

comment ( $string , $verbosity ) : void

Write a string as comment output.

Parameters

  • $string string
  • $verbosity int|string|null
public

question ( $string , $verbosity ) : void

Write a string as question output.

Parameters

  • $string string
  • $verbosity int|string|null
public

error ( $string , $verbosity ) : void

Write a string as error output.

Parameters

  • $string string
  • $verbosity int|string|null
public

warn ( $string , $verbosity ) : void

Write a string as warning output.

Parameters

  • $string string
  • $verbosity int|string|null
public

alert ( $string , $verbosity ) : void

Write a string in an alert box.

Parameters

  • $string string
  • $verbosity int|string|null
public

newLine ( $count ) : $this

Write a blank line.

Parameters

  • $count int
public

setInput ( Symfony\...\InputInterface $input ) : void

Set the input interface implementation.

Parameters

  • $input Symfony\...\InputInterface
public

setOutput ( OutputStyle $output ) : void

Set the output interface implementation.

Parameters

protected

setVerbosity ( $level ) : void

Set the verbosity level.

Parameters

  • $level string|int
protected

parseVerbosity ( $level ) : int

Get the verbosity level in terms of Symfony's OutputInterface level.

Parameters

  • $level string|int|null
public

getOutput ( ) : OutputStyle

Get the output implementation.

public

outputComponents ( ) : Factory

Get the output component factory implementation.