Zum Inhalt springen
PHP Ecosystem
Explore

Installation guide

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

  • 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.

Install the package with Composer.

Terminal window
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');

Back to documentation