StreamOutput

class StreamOutput extends Output

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));

Methods

__construct(resource $stream, int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)
resource getStream()

Gets the stream attached to this StreamOutput instance.

Details

__construct(resource $stream, int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)

Parameters

resource $stream A stream resource
int $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
bool $decorated Whether to decorate messages (null for auto-guessing)
OutputFormatterInterface $formatter Output formatter instance (null to use default OutputFormatter)

Exceptions

InvalidArgumentException When first argument is not a real stream

resource getStream()

Gets the stream attached to this StreamOutput instance.

Return Value

resource A stream resource

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Component/Console/Output/StreamOutput.html