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
No description
Writes a message to the output and adds a newline at the end.
Writes a message to the output.
Writes a message to the output.
Gets the stream attached to this StreamOutput instance.
Returns true if the stream supports colorization.
Details
__construct(resource $stream, int|null $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)
writeln(string|iterable $messages, int $options = self::OUTPUT_NORMAL)
Writes a message to the output and adds a newline at the end.
write(string|iterable $messages, bool $newline = false, int $options = self::OUTPUT_NORMAL)
Writes a message to the output.
protected bool
hasColorSupport()
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