A decorator that extends Symfony OutputInterface with:
- Multiple message types: info, success, error, fatal, and plain messages
- Automatic indentation with indent control methods
- Parameter substitution using sprintf formatting
- Full Symfony OutputInterface compatibility
Install via Composer:
composer require imponeer/log-data-output-decoratoruse Imponeer\Decorators\LogDataOutput\OutputDecorator;
use Symfony\Component\Console\Output\ConsoleOutput;
$output = new OutputDecorator(new ConsoleOutput());
// Different message types
$output->info('This is an info message');
$output->success('Operation completed successfully');
$output->error('An error occurred');
$output->fatal('Critical error - application stopping');
$output->msg('Plain message without formatting');$output->info('Main process started');
$output->incrIndent();
$output->info('Sub-process 1');
$output->info('Sub-process 2');
$output->incrIndent();
$output->info('Nested sub-process');
$output->decrIndent();
$output->info('Back to sub-process level');
$output->resetIndent();
$output->info('Back to main level');Output:
Main process started
  Sub-process 1
  Sub-process 2
    Nested sub-process
  Back to sub-process level
Back to main level
$output->info('Processing file: %s', 'example.txt');
$output->success('Processed %d files in %s seconds', 42, '1.23');
$output->error('Failed to process %s: %s', 'file.txt', 'Permission denied');use Imponeer\Decorators\LogDataOutput\OutputDecorator;
use Symfony\Component\Console\Output\BufferedOutput;
$bufferedOutput = new BufferedOutput();
$output = new OutputDecorator($bufferedOutput);
$output->info('Starting batch process');
$output->incrIndent();
foreach (['file1.txt', 'file2.txt', 'file3.txt'] as $index => $file) {
    $output->info('Processing file %d: %s', $index + 1, $file);
    $output->incrIndent();
    if ($file === 'file2.txt') {
        $output->error('Failed to process %s', $file);
    } else {
        $output->success('Successfully processed %s', $file);
    }
    $output->decrIndent();
}
$output->resetIndent();
$output->info('Batch process completed');
// Get the formatted output
echo $bufferedOutput->fetch();Complete API documentation with all methods and examples is available in the project wiki, which is automatically generated from the source code.
Run the test suite:
composer testCheck code style compliance:
composer phpcsFix code style issues automatically:
composer phpcbfRun static analysis:
composer phpstanWe welcome contributions! Here's how you can help:
- Fork the repository on GitHub
- Create a feature branch (git checkout -b feature/amazing-feature)
- Make your changes and add tests if applicable
- Run the test suite to ensure everything works
- Commit your changes (git commit -am 'Add amazing feature')
- Push to the branch (git push origin feature/amazing-feature)
- Create a Pull Request
- Follow PSR-12 coding standards
- Add tests for new functionality
- Update documentation for API changes
- Ensure all tests pass before submitting PR
Found a bug or have a suggestion? Please open an issue with:
- Clear description of the problem or suggestion
- Steps to reproduce (for bugs)
- Expected vs actual behavior
- PHP and Symfony Console versions