Compare two Images, Texts or Files.
Via Composer
$ composer require karakhanyans/comparison
Add Service provider into providers array in config/app.php
Karakhanyans\Comparison\ComparisonServiceProvider::class,
$compare = new Compare();
echo $compare->images('path_to_first_image','path_to_second_image'); // will print difference percent
echo $compare->files('path_to_first_file','path_to_second_file'); // after this you can use following actions
echo $compare->differentWords(); // array with different words between two files
echo $compare->differentWordsCount(); // count of different words
echo $compare->differencePercent(); // difference in percent
echo $compare->sameWords(); // array with same words
echo $compare->sameWordsCount(); // count of same words
echo $compare->showFormattedText(); // will print different words highlighted in text
To compare texts you can use $compare->files() or $compare->texts();
##Configs
You can configure formatted styles, tags etc.
By default for highlighting plugin using <b> tag and #00BB00 color
To change that you should add configs before $compare->files();
$compare->tag('pre'); // will set tag to <pre>
$compare->style('color:#cccccc'); // will change highlighted color
$compare->class('className'); // class name
Please see CHANGELOG for more information on what has changed recently.
$ composer test
Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email karakhanyansa@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.