\Symfony\Component\Console\OutputStreamOutput

StreamOutput writes the output to a given stream.

Usage:

$output = new StreamOutput(fopen('php://stdout', 'w'));

As StreamOutput can use any stream, you can also use a file:

$output = new StreamOutput(fopen('/path/to/output.log', 'a', false));

Summary

Methods
Properties
Constants
__construct()
getStream()
No public properties found
No constants found
doWrite()
hasColorSupport()
No protected properties found
N/A
No private methods found
$stream
N/A

Properties

$stream

$stream : 

Type

Methods

__construct()

__construct(resource  $stream, integer  $verbosity = self::VERBOSITY_NORMAL, boolean|null  $decorated = null, \Symfony\Component\Console\Formatter\OutputFormatterInterface|null  $formatter = null) 

Parameters

resource $stream

A stream resource

integer $verbosity

The verbosity level (one of the VERBOSITY constants in OutputInterface)

boolean|null $decorated

Whether to decorate messages (null for auto-guessing)

\Symfony\Component\Console\Formatter\OutputFormatterInterface|null $formatter

Output formatter instance (null to use default OutputFormatter)

Throws

\Symfony\Component\Console\Exception\InvalidArgumentException

When first argument is not a real stream

getStream()

getStream() : resource

Gets the stream attached to this StreamOutput instance.

Returns

resource —

A stream resource

doWrite()

doWrite(  $message,   $newline) 

{@inheritdoc}

Parameters

$message
$newline

hasColorSupport()

hasColorSupport() : boolean

Returns true if the stream supports colorization.

Colorization is disabled if not supported by the stream:

This is tricky on Windows, because Cygwin, Msys2 etc emulate pseudo terminals via named pipes, so we can only check the environment.

Reference: Composer\XdebugHandler\Process::supportsColor https://github.com/composer/xdebug-handler

Returns

boolean —

true if the stream supports colorization, false otherwise