Download the PHP package wikimedia/wikidiff2 without Composer

On this page you can find all versions of the php package wikimedia/wikidiff2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wikidiff2

wikidiff2

Wikidiff2 is a PHP extension which formats changes between two input texts, producing HTML or JSON.

It performs word-level diffs, including support for Thai word segmentation. It can detect moved and split lines.

Dependencies

To build wikidiff2 as a PHP extension, you also need the php-dev and pkg-config packages.

Compilation and installation

License

wikidiff2 is licensed under the GPL v2 or any later version.

Historically the PHP License was incompatible with the GPL, meaning that binaries were not redistributable. However that was resolved in 2026 with version 4 of the PHP License, which is merely the BSD-3-Clause license and explicitly GPL compatible.

See COPYING and https://www.php.net/license/ for more details.

Configuration

The following php.ini settings are supported:

wikidiff2.moved_line_threshold

Wikidiff2 estimates similarity of added and deleted lines based on changed character count. When the similarity of an added and deleted line is greater than this threshold, the lines are displayed as moved.

Range 0.0 .. 1.0. Default 0.4.

wikidiff2.change_threshold

Changed lines with a similarity value below this threshold will be split into a deleted line and added line. This helps matching up moved lines in some cases.

Range 0.0 .. 1.0. Default 0.2.

wikidiff2.moved_paragraph_detection_cutoff

When the number of added and deleted lines in a table diff is greater than this limit, no attempt to detect moved lines will be made.

Default 100.

wikidiff2.max_word_level_diff_complexity

When comparing two lines for changes within the line, a word-level diff will be done unless the product of the LHS word count and the RHS word count exceeds this limit.

Default 40000000.

Usage

The input is assumed to be UTF-8 encoded. Invalid UTF-8 may cause undesirable operation, such as truncation of the output, so the input should be validated by the application. The input text should have UNIX-style line endings.

wikidiff2_do_diff

Compare two strings $text1 and $text2, and produce output formatted as a fragment of an HTML table, that is, a series of <tr> elements.

$numContextLines is the number of copied context lines shown before and after each change. Before each block of context lines and changes, a line number will appear as an HTML comment inside a tr/td, e.g.

This allows the application to localize line numbers.

wikidiff2_inline_diff

Compare two strings $text1 and $text2, and produce output formatted as inline HTML.

wikidiff2_inline_json_diff

Compare two strings $text1 and $text2 and produce output formatted as JSON. See the JSON diff format documentation.

wikidiff2_multi_format_diff

Compare two strings $text1 and $text2 with an associative array of options:

The return value is an associative array of formatted outputs. The key of each element is the format name table, inline or inlineJSON, and the value is a string.

wikidiff2_version

Produces the same thing as phpversion('wikidiff2'). Probably should be deprecated.


All versions of wikidiff2 with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wikimedia/wikidiff2 contains the following files

Loading the files please wait ...