{"id":13742969,"url":"https://github.com/jfcherng/php-diff","last_synced_at":"2025-05-14T01:03:45.551Z","repository":{"id":40300790,"uuid":"167409830","full_name":"jfcherng/php-diff","owner":"jfcherng","description":"A comprehensive library for generating differences between two strings in multiple formats (unified, side by side HTML etc).","archived":false,"fork":false,"pushed_at":"2024-11-06T20:34:19.000Z","size":1341,"stargazers_count":438,"open_issues_count":6,"forks_count":51,"subscribers_count":10,"default_branch":"v6","last_synced_at":"2025-04-10T12:24:03.945Z","etag":null,"topics":["diff","hacktoberfest","psr-1","psr-12","psr-4"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/jfcherng/php-diff","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jfcherng.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG/CHANGELOG_v2.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"https://www.paypal.me/jfcherng/5usd"}},"created_at":"2019-01-24T17:42:38.000Z","updated_at":"2025-04-09T18:21:23.000Z","dependencies_parsed_at":"2023-02-10T16:16:03.412Z","dependency_job_id":"d1a2c278-7035-40e9-9ac4-0370efd902a0","html_url":"https://github.com/jfcherng/php-diff","commit_stats":{"total_commits":689,"total_committers":26,"mean_commits":26.5,"dds":"0.053701015965166854","last_synced_commit":"58e515035f588eecc44f4a0ad85838cd1069b129"},"previous_names":[],"tags_count":148,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfcherng%2Fphp-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfcherng%2Fphp-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfcherng%2Fphp-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfcherng%2Fphp-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jfcherng","download_url":"https://codeload.github.com/jfcherng/php-diff/tar.gz/refs/heads/v6","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248959954,"owners_count":21189970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["diff","hacktoberfest","psr-1","psr-12","psr-4"],"created_at":"2024-08-03T05:00:38.379Z","updated_at":"2025-04-14T20:42:35.420Z","avatar_url":"https://github.com/jfcherng.png","language":"PHP","readme":"# php-diff\n\n[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/jfcherng/php-diff/php.yml?branch=v6\u0026style=flat-square)](https://github.com/jfcherng/php-diff/actions)\n[![Codacy grade](https://img.shields.io/codacy/grade/5b7ab5ed613d48b99f12cd334f6489ff/v6?style=flat-square)](https://app.codacy.com/project/jfcherng/php-diff/dashboard)\n[![Packagist](https://img.shields.io/packagist/dt/jfcherng/php-diff?style=flat-square)](https://packagist.org/packages/jfcherng/php-diff)\n[![Packagist Version](https://img.shields.io/packagist/v/jfcherng/php-diff?style=flat-square)](https://packagist.org/packages/jfcherng/php-diff)\n[![Project license](https://img.shields.io/github/license/jfcherng/php-diff?style=flat-square)](https://github.com/jfcherng/php-diff/blob/v6/LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/jfcherng/php-diff?style=flat-square\u0026logo=github)](https://github.com/jfcherng/php-diff/stargazers)\n[![Donate to this project using Paypal](https://img.shields.io/badge/paypal-donate-blue.svg?style=flat-square\u0026logo=paypal)](https://www.paypal.me/jfcherng/5usd)\n\nA comprehensive library for generating diff between two strings.\n\n## Introduction\n\nGenerated diff can be rendered in all of the standard formats including:\n\n**Text** renderers:\n\n- Context\n- Json (plain text)\n- Unified\n\n**HTML** renderers:\n\n- Combined\n- Inline\n- Json (HTML)\n- Side by Side\n\nNote that for HTML rendered results, you have to add CSS for a better visualization.\nYou may modify one from `example/diff-table.css` or write your own from zero.\n\nIf you are okay with the default CSS, there is `\\Jfcherng\\Diff\\DiffHelper::getStyleSheet()`\nwhich can be used to get the content of the `example/diff-table.css`.\n\n## Requirements\n\n![php](https://img.shields.io/badge/php-%E2%89%A57.4.0-blue?style=flat-square)\n![ext-iconv](https://img.shields.io/badge/ext-iconv-brightgreen?style=flat-square)\n\n## Installation\n\nThis package is available on `Packagist` by the name of [jfcherng/php-diff](https://packagist.org/packages/jfcherng/php-diff).\n\n```bash\ncomposer require jfcherng/php-diff\n```\n\n## Example\n\nSee files and readme in the [example/](https://github.com/jfcherng/php-diff/blob/v6/example) directory.\n\n```php\n\u003c?php\n\ninclude __DIR__ . '/vendor/autoload.php';\n\nuse Jfcherng\\Diff\\Differ;\nuse Jfcherng\\Diff\\DiffHelper;\nuse Jfcherng\\Diff\\Factory\\RendererFactory;\nuse Jfcherng\\Diff\\Renderer\\RendererConstant;\n\n$oldFile = __DIR__ . '/example/old_file.txt';\n$newFile = __DIR__ . '/example/new_file.txt';\n\n$old = 'This is the old string.';\n$new = 'And this is the new one.';\n\n// renderer class name:\n//     Text renderers: Context, JsonText, Unified\n//     HTML renderers: Combined, Inline, JsonHtml, SideBySide\n$rendererName = 'Unified';\n\n// the Diff class options\n$differOptions = [\n    // show how many neighbor lines\n    // Differ::CONTEXT_ALL can be used to show the whole file\n    'context' =\u003e 3,\n    // ignore case difference\n    'ignoreCase' =\u003e false,\n    // ignore line ending difference\n    'ignoreLineEnding' =\u003e false,\n    // ignore whitespace difference\n    'ignoreWhitespace' =\u003e false,\n    // if the input sequence is too long, it will just gives up (especially for char-level diff)\n    'lengthLimit' =\u003e 2000,\n    // if truthy, when inputs are identical, the whole inputs will be rendered in the output\n    'fullContextIfIdentical' =\u003e false,\n];\n\n// the renderer class options\n$rendererOptions = [\n    // how detailed the rendered HTML in-line diff is? (none, line, word, char)\n    'detailLevel' =\u003e 'line',\n    // renderer language: eng, cht, chs, jpn, ...\n    // or an array which has the same keys with a language file\n    // check the \"Custom Language\" section in the readme for more advanced usage\n    'language' =\u003e 'eng',\n    // show line numbers in HTML renderers\n    'lineNumbers' =\u003e true,\n    // show a separator between different diff hunks in HTML renderers\n    'separateBlock' =\u003e true,\n    // show the (table) header\n    'showHeader' =\u003e true,\n    // the frontend HTML could use CSS \"white-space: pre;\" to visualize consecutive whitespaces\n    // but if you want to visualize them in the backend with \"\u0026nbsp;\", you can set this to true\n    'spacesToNbsp' =\u003e false,\n    // HTML renderer tab width (negative = do not convert into spaces)\n    'tabSize' =\u003e 4,\n    // this option is currently only for the Combined renderer.\n    // it determines whether a replace-type block should be merged or not\n    // depending on the content changed ratio, which values between 0 and 1.\n    'mergeThreshold' =\u003e 0.8,\n    // this option is currently only for the Unified and the Context renderers.\n    // RendererConstant::CLI_COLOR_AUTO = colorize the output if possible (default)\n    // RendererConstant::CLI_COLOR_ENABLE = force to colorize the output\n    // RendererConstant::CLI_COLOR_DISABLE = force not to colorize the output\n    'cliColorization' =\u003e RendererConstant::CLI_COLOR_AUTO,\n    // this option is currently only for the Json renderer.\n    // internally, ops (tags) are all int type but this is not good for human reading.\n    // set this to \"true\" to convert them into string form before outputting.\n    'outputTagAsString' =\u003e false,\n    // this option is currently only for the Json renderer.\n    // it controls how the output JSON is formatted.\n    // see available options on https://www.php.net/manual/en/function.json-encode.php\n    'jsonEncodeFlags' =\u003e \\JSON_UNESCAPED_SLASHES | \\JSON_UNESCAPED_UNICODE,\n    // this option is currently effective when the \"detailLevel\" is \"word\"\n    // characters listed in this array can be used to make diff segments into a whole\n    // for example, making \"\u003cdel\u003egood\u003c/del\u003e-\u003cdel\u003elooking\u003c/del\u003e\" into \"\u003cdel\u003egood-looking\u003c/del\u003e\"\n    // this should bring better readability but set this to empty array if you do not want it\n    'wordGlues' =\u003e [' ', '-'],\n    // change this value to a string as the returned diff if the two input strings are identical\n    'resultForIdenticals' =\u003e null,\n    // extra HTML classes added to the DOM of the diff container\n    'wrapperClasses' =\u003e ['diff-wrapper'],\n];\n\n// one-line simply compare two files\n$result = DiffHelper::calculateFiles($oldFile, $newFile, $rendererName, $differOptions, $rendererOptions);\n// one-line simply compare two strings\n$result = DiffHelper::calculate($old, $new, $rendererName, $differOptions, $rendererOptions);\n// or even shorter if you are happy with default options\n$result = DiffHelper::calculate($old, $new, $rendererName);\n\n// custom usage\n$differ = new Differ(explode(\"\\n\", $old), explode(\"\\n\", $new), $differOptions);\n$renderer = RendererFactory::make($rendererName, $rendererOptions); // or your own renderer object\n$result = $renderer-\u003erender($differ);\n\n// use the JSON result to render in HTML\n$jsonResult = DiffHelper::calculate($old, $new, 'Json'); // may store the JSON result in your database\n$htmlRenderer = RendererFactory::make('Inline', $rendererOptions);\n$result = $htmlRenderer-\u003erenderArray(json_decode($jsonResult, true));\n```\n\n## Rendered Results\n\n### HTML Diff In-line Detailed Rendering\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth\u003eNone-level\u003c/th\u003e\n    \u003cth\u003eLine-level (Default)\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cimg src=\"https://raw.githubusercontent.com/jfcherng/php-diff/v6/example/images/inline-none-level-diff.png\"\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003cimg src=\"https://raw.githubusercontent.com/jfcherng/php-diff/v6/example/images/inline-line-level-diff.png\"\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003cth\u003eWord-level\u003c/th\u003e\n    \u003cth\u003eChar-level\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cimg src=\"https://raw.githubusercontent.com/jfcherng/php-diff/v6/example/images/inline-word-level-diff.png\"\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003cimg src=\"https://raw.githubusercontent.com/jfcherng/php-diff/v6/example/images/inline-char-level-diff.png\"\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n### Renderer: Inline\n\n```php\n\u003c?php $rendererOptions = ['detailLevel' =\u003e 'line'];\n```\n\n![Inline](https://raw.githubusercontent.com/jfcherng/php-diff/v6/example/images/inline-renderer.png)\n\n### Renderer: Side By Side\n\n```php\n\u003c?php $rendererOptions = ['detailLevel' =\u003e 'line'];\n```\n\n![Side By Side](https://raw.githubusercontent.com/jfcherng/php-diff/v6/example/images/side-by-side-renderer.png)\n\n### Renderer: Combined\n\n```php\n\u003c?php $rendererOptions = ['detailLevel' =\u003e 'word'];\n```\n\nThis renderer is suitable for articles and always has no line number information.\n\n![Combined](https://raw.githubusercontent.com/jfcherng/php-diff/v6/example/images/combined-renderer-word-level.png)\n\n### Renderer: Unified\n\nAbout the `Unified` diff format: https://en.wikipedia.org/wiki/Diff#Unified_format\n\n```diff\n@@ -1,3 +1,4 @@\n-\u003cp\u003eHello World!\u003c/p\u003e\n+\u003cdiv\u003eHello World!\u003c/div\u003e\n ~~~~~~~~~~~~~~~~~~~\n+Let's add a new line here.\n X\n@@ -7,6 +8,5 @@\n N\n-Do you know in Chinese, \"金槍魚罐頭\" means tuna can.\n+Do you know in Japanese, \"魚の缶詰\" means fish can.\n This is just a useless line.\n G\n-// remember to delete this line\n Say hello to my neighbors.\n```\n\n### Renderer: Context\n\nAbout the `Context` diff format: https://en.wikipedia.org/wiki/Diff#Context_format\n\n\u003cdetails\u003e\u003csummary\u003eClick to expand\u003c/summary\u003e\n\n```diff\n***************\n*** 1,3 ****\n! \u003cp\u003eHello World!\u003c/p\u003e\n  ~~~~~~~~~~~~~~~~~~~\n  X\n--- 1,4 ----\n! \u003cdiv\u003eHello World!\u003c/div\u003e\n  ~~~~~~~~~~~~~~~~~~~\n+ Let's add a new line here.\n  X\n***************\n*** 7,12 ****\n  N\n! Do you know in Chinese, \"金槍魚罐頭\" means tuna can.\n  This is just a useless line.\n  G\n- // remember to delete this line\n  Say hello to my neighbors.\n--- 8,12 ----\n  N\n! Do you know in Japanese, \"魚の缶詰\" means fish can.\n  This is just a useless line.\n  G\n  Say hello to my neighbors.\n```\n\n\u003c/details\u003e\n\n### Renderer: Text JSON\n\nThis renderer has no detailed diff.\n\n\u003cdetails\u003e\u003csummary\u003eClick to expand\u003c/summary\u003e\n\n```json\n[\n  [\n    {\n      \"tag\": \"rep\",\n      \"old\": {\n        \"offset\": 0,\n        \"lines\": [\"\u003cp\u003eHello World! Good-looking.\u003c/p\u003e\"]\n      },\n      \"new\": {\n        \"offset\": 0,\n        \"lines\": [\"\u003cdiv\u003eHello World! Bad-tempered.\u003c/div\u003e\"]\n      }\n    },\n    {\n      \"tag\": \"eq\",\n      \"old\": {\n        \"offset\": 1,\n        \"lines\": [\"~~~~~~~~~~~~~~~~~~~\"]\n      },\n      \"new\": {\n        \"offset\": 1,\n        \"lines\": [\"~~~~~~~~~~~~~~~~~~~\"]\n      }\n    },\n    {\n      \"tag\": \"ins\",\n      \"old\": {\n        \"offset\": 2,\n        \"lines\": []\n      },\n      \"new\": {\n        \"offset\": 2,\n        \"lines\": [\"Let's add a new line here.\"]\n      }\n    },\n    {\n      \"tag\": \"eq\",\n      \"old\": {\n        \"offset\": 2,\n        \"lines\": [\"X\"]\n      },\n      \"new\": {\n        \"offset\": 3,\n        \"lines\": [\"X\"]\n      }\n    }\n  ],\n  [\n    {\n      \"tag\": \"eq\",\n      \"old\": {\n        \"offset\": 6,\n        \"lines\": [\"N\"]\n      },\n      \"new\": {\n        \"offset\": 7,\n        \"lines\": [\"N\"]\n      }\n    },\n    {\n      \"tag\": \"rep\",\n      \"old\": {\n        \"offset\": 7,\n        \"lines\": [\"Do you know in Chinese, \\\"金槍魚罐頭\\\" means tuna can.\"]\n      },\n      \"new\": {\n        \"offset\": 8,\n        \"lines\": [\"Do you know in Japanese, \\\"魚の缶詰\\\" means fish can.\"]\n      }\n    },\n    {\n      \"tag\": \"eq\",\n      \"old\": {\n        \"offset\": 8,\n        \"lines\": [\"\\t  \\tTab visualization test.\", \"G\"]\n      },\n      \"new\": {\n        \"offset\": 9,\n        \"lines\": [\"\\t  \\tTab visualization test.\", \"G\"]\n      }\n    },\n    {\n      \"tag\": \"del\",\n      \"old\": {\n        \"offset\": 10,\n        \"lines\": [\"// remember to delete this line\"]\n      },\n      \"new\": {\n        \"offset\": 11,\n        \"lines\": []\n      }\n    },\n    {\n      \"tag\": \"eq\",\n      \"old\": {\n        \"offset\": 11,\n        \"lines\": [\"Say hello to my neighbors.\"]\n      },\n      \"new\": {\n        \"offset\": 11,\n        \"lines\": [\"Say hello to my neighbors.\"]\n      }\n    }\n  ],\n  [\n    {\n      \"tag\": \"eq\",\n      \"old\": {\n        \"offset\": 14,\n        \"lines\": [\"B\"]\n      },\n      \"new\": {\n        \"offset\": 14,\n        \"lines\": [\"B\"]\n      }\n    },\n    {\n      \"tag\": \"rep\",\n      \"old\": {\n        \"offset\": 15,\n        \"lines\": [\"Donec rutrum.\"]\n      },\n      \"new\": {\n        \"offset\": 15,\n        \"lines\": [\"Donec rutrum test.\", \"There is a new inserted line.\"]\n      }\n    },\n    {\n      \"tag\": \"eq\",\n      \"old\": {\n        \"offset\": 16,\n        \"lines\": [\"C\"]\n      },\n      \"new\": {\n        \"offset\": 17,\n        \"lines\": [\"C\"]\n      }\n    },\n    {\n      \"tag\": \"rep\",\n      \"old\": {\n        \"offset\": 17,\n        \"lines\": [\"Sed dictum lorem ipsum.\"]\n      },\n      \"new\": {\n        \"offset\": 18,\n        \"lines\": [\"Sed dolor lorem ipsum hendrerit.\"]\n      }\n    },\n    {\n      \"tag\": \"eq\",\n      \"old\": {\n        \"offset\": 18,\n        \"lines\": [\"\"]\n      },\n      \"new\": {\n        \"offset\": 19,\n        \"lines\": [\"\"]\n      }\n    }\n  ]\n]\n```\n\n\u003c/details\u003e\n\n### Renderer: HTML JSON\n\nFor a `\"tag\": \"rep\" (8)` block, this renderer has HTML-style detailed diff.\nIf you don't need those detailed diff, consider using the `JsonText` renderer.\n\n\u003cdetails\u003e\u003csummary\u003eClick to expand\u003c/summary\u003e\n\n```json\n[\n  [\n    {\n      \"tag\": \"rep\",\n      \"old\": {\n        \"offset\": 0,\n        \"lines\": [\"\u0026lt;\u003cdel\u003ep\u0026gt;Hello World! Good-looking.\u0026lt;/p\u003c/del\u003e\u0026gt;\"]\n      },\n      \"new\": {\n        \"offset\": 0,\n        \"lines\": [\"\u0026lt;\u003cins\u003ediv\u0026gt;Hello World! Bad-tempered.\u0026lt;/div\u003c/ins\u003e\u0026gt;\"]\n      }\n    },\n    {\n      \"tag\": \"eq\",\n      \"old\": {\n        \"offset\": 1,\n        \"lines\": [\"~~~~~~~~~~~~~~~~~~~\"]\n      },\n      \"new\": {\n        \"offset\": 1,\n        \"lines\": [\"~~~~~~~~~~~~~~~~~~~\"]\n      }\n    },\n    {\n      \"tag\": \"ins\",\n      \"old\": {\n        \"offset\": 2,\n        \"lines\": [\"\"]\n      },\n      \"new\": {\n        \"offset\": 2,\n        \"lines\": [\"Let's add a new line here.\"]\n      }\n    },\n    {\n      \"tag\": \"eq\",\n      \"old\": {\n        \"offset\": 2,\n        \"lines\": [\"X\"]\n      },\n      \"new\": {\n        \"offset\": 3,\n        \"lines\": [\"X\"]\n      }\n    }\n  ],\n  [\n    {\n      \"tag\": \"eq\",\n      \"old\": {\n        \"offset\": 6,\n        \"lines\": [\"N\"]\n      },\n      \"new\": {\n        \"offset\": 7,\n        \"lines\": [\"N\"]\n      }\n    },\n    {\n      \"tag\": \"rep\",\n      \"old\": {\n        \"offset\": 7,\n        \"lines\": [\"Do you know in \u003cdel\u003eChinese, \\\"金槍魚罐頭\\\" means tuna\u003c/del\u003e can.\"]\n      },\n      \"new\": {\n        \"offset\": 8,\n        \"lines\": [\"Do you know in \u003cins\u003eJapanese, \\\"魚の缶詰\\\" means fish\u003c/ins\u003e can.\"]\n      }\n    },\n    {\n      \"tag\": \"eq\",\n      \"old\": {\n        \"offset\": 8,\n        \"lines\": [\"\\t  \\tTab visualization test.\", \"G\"]\n      },\n      \"new\": {\n        \"offset\": 9,\n        \"lines\": [\"\\t  \\tTab visualization test.\", \"G\"]\n      }\n    },\n    {\n      \"tag\": \"del\",\n      \"old\": {\n        \"offset\": 10,\n        \"lines\": [\"// remember to delete this line\"]\n      },\n      \"new\": {\n        \"offset\": 11,\n        \"lines\": [\"\"]\n      }\n    },\n    {\n      \"tag\": \"eq\",\n      \"old\": {\n        \"offset\": 11,\n        \"lines\": [\"Say hello to my neighbors.\"]\n      },\n      \"new\": {\n        \"offset\": 11,\n        \"lines\": [\"Say hello to my neighbors.\"]\n      }\n    }\n  ],\n  [\n    {\n      \"tag\": \"eq\",\n      \"old\": {\n        \"offset\": 14,\n        \"lines\": [\"B\"]\n      },\n      \"new\": {\n        \"offset\": 14,\n        \"lines\": [\"B\"]\n      }\n    },\n    {\n      \"tag\": \"rep\",\n      \"old\": {\n        \"offset\": 15,\n        \"lines\": [\"Donec rutrum.\"]\n      },\n      \"new\": {\n        \"offset\": 15,\n        \"lines\": [\"Donec rutrum test.\", \"There is a new inserted line.\"]\n      }\n    },\n    {\n      \"tag\": \"eq\",\n      \"old\": {\n        \"offset\": 16,\n        \"lines\": [\"C\"]\n      },\n      \"new\": {\n        \"offset\": 17,\n        \"lines\": [\"C\"]\n      }\n    },\n    {\n      \"tag\": \"rep\",\n      \"old\": {\n        \"offset\": 17,\n        \"lines\": [\"Sed d\u003cdel\u003eictum lorem ipsum\u003c/del\u003e.\"]\n      },\n      \"new\": {\n        \"offset\": 18,\n        \"lines\": [\"Sed d\u003cins\u003eolor lorem ipsum hendrerit\u003c/ins\u003e.\"]\n      }\n    },\n    {\n      \"tag\": \"eq\",\n      \"old\": {\n        \"offset\": 18,\n        \"lines\": [\"\"]\n      },\n      \"new\": {\n        \"offset\": 19,\n        \"lines\": [\"\"]\n      }\n    }\n  ]\n]\n```\n\n\u003c/details\u003e\n\n## Custom Language\n\n### Override an Existing Language\n\nIf you just want to override some translations of an existing language...\n\n```php\n$rendererOptions = [\n  'language' =\u003e [\n    // use English as the base language\n    'eng',\n    // your custom overrides\n    [\n      // use \"Diff\" as the new value of the \"differences\" key\n      'differences' =\u003e 'Diff',\n    ],\n    // maybe more overrides if you somehow need them...\n  ],\n]\n```\n\n## Acknowledgment\n\nThis package is built on the top of [chrisboulton/php-diff](https://github.com/chrisboulton/php-diff) initially.\nBut the original repository looks like no longer maintained.\nHere have been quite lots of rewrites and new features since then, hence I re-started this as a new package for better visibility.\n","funding_links":["https://www.paypal.me/jfcherng/5usd"],"categories":["Configuration"],"sub_categories":["Diffing files"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfcherng%2Fphp-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjfcherng%2Fphp-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfcherng%2Fphp-diff/lists"}