karakhanyans / comparison by karakhanyans

Compare two Images, Texts or Files and get the difference.
668
6
2
Package Data
Maintainer Username: karakhanyans
Maintainer Contact: karakhanyansa@gmail.com (Sergey Karakhanyan)
Package Create Date: 2016-12-25
Package Last Update: 2017-02-02
Language: PHP
License: MIT
Last Refreshed: 2024-04-18 03:03:31
Package Statistics
Total Downloads: 668
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 6
Total Watchers: 2
Total Forks: 1
Total Open Issues: 0

Compare two Images, Texts or Files.

Latest Version on Packagist Software License Total Downloads

Compare two Images, Texts or Files.

Install

Via Composer

$ composer require karakhanyans/comparison

Usage

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

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email karakhanyansa@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.