2017 © Pedro PelĂĄez
 

library laravel-diff

Diff tool for Laravel 5

image

vi-kon/laravel-diff

Diff tool for Laravel 5

  • Saturday, January 9, 2016
  • by vincekovacs
  • Repository
  • 2 Watchers
  • 26 Stars
  • 5,156 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 10 Forks
  • 2 Open issues
  • 5 Versions
  • 9 % Grown

The README.md

Diff tool

This package is for comparison strings and show changes., (*1)

Table of content


Back to top, (*2)

Features

  • compare strings
  • compare files
  • group string differences into hunk groups

Installation

Via composer:, (*3)

composer require vi-kon/laravel-diff

Back to top, (*4)

Usage

Simple usage:, (*5)

// Compare string line by line
$diff = Diff::compare("hello\na", "hello\nasd\na");
// Outputs span, ins, del HTML tags, depend if entry
// is unmodified, inserted or deleted
echo $diff->toHTML();

Compare two file:, (*6)

// Compare files line by line
$diff = Diff::compareFiles("a.txt", "b.txt");
echo $diff->toHTML();

You can customize output by getting raw data:, (*7)


$options = [ // Compare by line or by characters 'compareCharacters' => false, // Offset size in hunk groups 'offset' => 2, ]; $diff = Diff::compare("hello\na", "hello\nasd\na", $options); $groups = $diff->getGroups(); foreach($groups as $i => $group) { // Output: Hunk 1 : Lines 2 - 6 echo 'Hunk ' . $i . ' : Lines ' . $group->getFirstPosition() . ' - ' . $group->getLastPosition(); // Output changed lines (entries) foreach($group->getEntries() as $entry) { // Output old position of line echo $entry instanceof \ViKon\Diff\Entry\InsertedEntry ? '-' : $entry->getOldPosition() + 1; echo ' | '; // Output new position of line echo $entry instanceof \ViKon\Diff\Entry\DeletedEntry ? '-' : $entry->getNewPosition() + 1; echo ' - '; // Output line (entry) echo $entry; } }

Back to top, (*8)

License

This package is licensed under the MIT License, (*9)


Back to top, (*10)

The Versions

09/01 2016

dev-master

9999999-dev https://github.com/vi-kon/laravel-diff

Diff tool for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

by KovĂĄcs Vince

laravel diff compare

09/01 2016

dev-develop

dev-develop https://github.com/vi-kon/laravel-diff

Diff tool for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

by KovĂĄcs Vince

laravel diff compare

09/01 2016

v1.0.2

1.0.2.0 https://github.com/vi-kon/laravel-diff

Diff tool for Laravel 5

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

by KovĂĄcs Vince

laravel diff compare

02/03 2015

v1.0.1

1.0.1.0 https://github.com/vi-kon/laravel-diff

  Sources   Download

MIT

The Requires

 

by KovĂĄcs Vince

laravel diff compare

01/03 2015

v1.0.0

1.0.0.0 https://github.com/vi-kon/laravel-diff

  Sources   Download

MIT

The Requires

 

by KovĂĄcs Vince

laravel diff compare