symplify/console-color-diff

This package is abandoned and no longer maintained. The author suggests using the symplify/package-builder package instead.

Package to print diffs in console with colors

10.0.24 2022-02-19 17:40 UTC

This package is auto-updated.

Last update: 2022-02-19 18:44:36 UTC


README

Downloads total

Install

composer require symplify/console-color-diff

Add to config/bundles.php:

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\ConsoleColorDiff\ValueObject\ConsoleColorDiffConfig;

return static function (ContainerConfigurator $containerConfigurator): void {
    $containerConfigurator->import(ConsoleColorDiffConfig::FILE_PATH);
};

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.