symplify/console-color-diff

Package to print diffs in console with colors

This package is auto-updated.

Last update: 2021-10-11 15:00:32 UTC


README

Downloads total

Install

composer require symplify/console-color-diff

Add to config/bundles.php:

return [
    Symplify\ConsoleColorDiff\Bundle\ConsoleColorDiffBundle::class => [
        'all' => true,
    ],
];

Usage

namespace App;

use Symplify\ConsoleColorDiff\Console\Output\ConsoleDiffer;

class SomeCommand
{
    /**
     * @var ConsoleDiffer
     */
    private $consoleDiffer;

    public function __construct(ConsoleDiffer $consoleDiffer)
    {
        $this->consoleDiffer = $consoleDiffer;
    }

    public function run(): void
    {
        // prints colored diff to the console output
        $this->consoleDiffer->diff('oldContent', 'newContent');
    }
}

Report Issues

In case you are experiencing a bug or want to request a new feature head over to the Symplify monorepo issue tracker

Contribute

The sources of this package are contained in the Symplify monorepo. We welcome contributions for this package on symplify/symplify.