use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Console\Output\OutputInterface; $output = new ConsoleOutput(); $output->writeln('Hello, World!');
use Symfony\Component\Console\Output\OutputInterface; class MyCommand { private $output; public function __construct(OutputInterface $output) { $this->output = $output; } public function run() { $this->output->writeln('Starting command...'); // ... $this->output->writeln('Command finished.'); } } // In our console application... $myCommand = new MyCommand($output); $myCommand->run();In this example, we define a `MyCommand` class that takes an instance of the OutputInterface as a constructor argument. We use the `writeln()` method to output messages during the command's execution. Overall, the Symfony\Component\Console\Output\OutputInterface is a useful interface for writing to the console output in PHP applications.