{"id":15583679,"url":"https://github.com/sokil/php-diff","last_synced_at":"2025-04-12T06:34:27.696Z","repository":{"id":57055120,"uuid":"58739052","full_name":"sokil/php-diff","owner":"sokil","description":"Highlight diffs provided by Sebastian Bergmann diff","archived":false,"fork":false,"pushed_at":"2019-07-04T19:52:48.000Z","size":25,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-21T12:48:54.656Z","etag":null,"topics":["diff","diff-highlight","highlight","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sokil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-13T12:38:10.000Z","updated_at":"2019-07-04T19:52:49.000Z","dependencies_parsed_at":"2022-08-24T14:00:18.666Z","dependency_job_id":null,"html_url":"https://github.com/sokil/php-diff","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sokil%2Fphp-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sokil%2Fphp-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sokil%2Fphp-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sokil%2Fphp-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sokil","download_url":"https://codeload.github.com/sokil/php-diff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228885162,"owners_count":17986785,"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","diff-highlight","highlight","php"],"created_at":"2024-10-02T20:20:28.341Z","updated_at":"2024-12-09T11:41:02.987Z","avatar_url":"https://github.com/sokil.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-diff\n\nHighlight diffs provided by Sebastian Bergmann diff\n\n[![Build Status](https://travis-ci.org/sokil/php-diff.svg?branch=master)](https://travis-ci.org/sokil/php-diff)\n[![Coverage Status](https://coveralls.io/repos/github/sokil/php-diff/badge.svg?branch=master\u00261)](https://coveralls.io/github/sokil/php-diff?branch=master)\n[![Total Downloads](http://img.shields.io/packagist/dt/sokil/php-diff.svg?1)](https://packagist.org/packages/sokil/php-diff)\n\n## Installation\n\n```\ncomposer.phar require sokil/php-diff\n```\n\n## Useage\n\n```php\n\u003c?php\n\nuse Sokil\\Diff\\Change;\nuse Sokil\\Diff\\Renderer;\n\n$diffRenderer = new Renderer();\n$actualDiff = $diffRenderer-\u003erender(new Change(\n    implode(PHP_EOL, ['line1', 'line2', 'line3']),\n    implode(PHP_EOL, ['line1', 'line2changed', 'line3'])\n));\n\n```\n\n## Format of diff output\n\nFormat of diff tags may be configured. By default renders only two tags: `\u003cins\u003e` and `\u003cdel\u003e`. To \nhighlight output, use predefined format:\n\n```php\n\u003c?php\n$renderer = new Renderer([\n    'format' =\u003e Renderer::FORMAT_COLOUR\n]);\n```\n\nThis will produce following HTML:\n\n```html\nline1\n\u003cdel style=\"background: #ffe7e7;\"\u003eline2\u003c/del\u003e\n\u003cins style=\"background: #ddfade;\"\u003eline2changed\u003c/ins\u003e\nline3\n```\n\nTo fully customize style, use next syntax (this format has alias `Renderer::FORMAT_COLOUR`):\n\n```php\n\u003c?php\n$renderer = new Renderer([\n    'format' =\u003e [\n        'insert' =\u003e [\n            'tag' =\u003e 'ins',\n            'attributes' =\u003e 'style=\"background: #ddfade;\"',\n        ],\n        'delete' =\u003e [\n            'tag' =\u003e 'del',\n            'attributes' =\u003e 'style=\"background: #ffe7e7;\"',\n        ]\n    ]\n]);\n\n// this is same to\n$renderer = new Renderer([\n    'format' =\u003e Renderer::FORMAT_COLOUR\n]);\n```\n\nDefault format `Renderer::FORMAT_DEFAULT` has following notation:\n\n```php\n\u003c?php\n$renderer = new Renderer([\n    'insert' =\u003e [\n        'tag' =\u003e 'ins',\n    ],\n    'delete' =\u003e [\n        'tag' =\u003e 'del',\n    ]\n]);\n\n// this is same to\n$renderer = new Renderer([\n    'format' =\u003e Renderer::FORMAT_DEFAULT\n]);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsokil%2Fphp-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsokil%2Fphp-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsokil%2Fphp-diff/lists"}