Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 1.02 KB

installation.md

File metadata and controls

33 lines (21 loc) · 1.02 KB

Installation guide

System requirements

  • PHP 8.3 or higher.
  • Composer for dependency management.

The package has no runtime dependencies and needs no framework or PHP extension beyond the PHP core.

Installation

Install the package with Composer.

composer require php-forge/diff:^0.1

Every class lives in the PHPForge\Diff namespace and is loaded through the Composer autoloader. There is nothing to register or configure: instantiate LineDiffer and call diff(), or UnifiedDiffRenderer and call render().

use PHPForge\Diff\{LineDiffer, UnifiedDiffRenderer};

$lines = (new LineDiffer())->diff("first\nsecond", "first\nthird");
$patch = (new UnifiedDiffRenderer())->render("first\nsecond\n", "first\nthird\n", 'a/notes.txt', 'b/notes.txt');

Next steps

Back to documentation