1
- [ ![ Build Status] ( https://travis-ci.org/jfcherng/php-diff.svg?branch=v6 )] ( https://travis-ci.org/jfcherng/php-diff )
2
- [ ![ Codacy Badge] ( https://api.codacy.com/project/badge/Grade/3a7a07d2ed67434e8e8582ea4ec9867b )] ( https://app.codacy.com/app/jfcherng/php-diff?utm_source=github.com&utm_medium=referral&utm_content=jfcherng/php-diff&utm_campaign=Badge_Grade_Dashboard )
3
-
4
1
# php-diff
5
2
3
+ <a href =" https://travis-ci.org/jfcherng/php-diff " ><img alt =" Travis (.org) branch " src =" https://img.shields.io/travis/jfcherng/php-diff/v6 " ></a >
4
+ <a href =" https://app.codacy.com/project/jfcherng/php-diff/dashboard " ><img alt =" Codacy grade " src =" https://img.shields.io/codacy/grade/3a7a07d2ed67434e8e8582ea4ec9867b/v6 " ></a >
5
+ <a href =" https://packagist.org/packages/jfcherng/php-diff " ><img alt =" Packagist " src =" https://img.shields.io/packagist/dt/jfcherng/php-diff " ></a >
6
+ <a href =" https://packagist.org/packages/jfcherng/php-diff " ><img alt =" Packagist Version " src =" https://img.shields.io/packagist/v/jfcherng/php-diff " ></a >
7
+ <a href =" https://github.com/jfcherng/php-diff/blob/v6/LICENSE " ><img alt =" Project license " src =" https://img.shields.io/github/license/jfcherng/php-diff " ></a >
8
+ <a href =" https://github.com/jfcherng/php-diff/stargazers " ><img alt =" GitHub stars " src =" https://img.shields.io/github/stars/jfcherng/php-diff?logo=github " ></a >
9
+ <a href =" https://www.paypal.me/jfcherng/5usd " title =" Donate to this project using Paypal " ><img src =" https://img.shields.io/badge/paypal-donate-blue.svg?logo=paypal " /></a >
10
+
6
11
A comprehensive library for generating diff between two strings.
7
12
8
13
9
- # Introduction
14
+ ## Introduction
10
15
11
16
Generated diff can be rendered in all of the standard formats including:
12
17
@@ -20,20 +25,20 @@ Note that for HTML rendered results, you have to add CSS for a better visualizat
20
25
You may modify one from ` example/diff-table.css ` or write your own from zero.
21
26
22
27
23
- # Requirements
28
+ ## Requirements
24
29
25
- - PHP >= 7 .1.3
26
- - Extension: ` iconv ` (usually as a built-in in PHP )
30
+ ![ php ] ( https://img.shields.io/badge/php-%5E7 .1.3-blue )
31
+ ![ ext- iconv] ( https://img.shields.io/badge/ext-iconv-brightgreen )
27
32
28
33
29
- # Installation
34
+ ## Installation
30
35
31
- ```
36
+ ``` bash
32
37
$ composer require jfcherng/php-diff
33
38
```
34
39
35
40
36
- # Example
41
+ ## Example
37
42
38
43
See [ example/demo.php] ( https://github.com/jfcherng/php-diff/blob/v6/example/demo.php ) and files under ` tests/ ` .
39
44
@@ -98,10 +103,10 @@ $result = $renderer->render($differ);
98
103
```
99
104
100
105
101
- # Rendered Results
106
+ ## Rendered Results
102
107
103
108
104
- ## HTML Diff In-line Detailed Rendering
109
+ ### HTML Diff In-line Detailed Rendering
105
110
106
111
<table >
107
112
<tr >
@@ -123,17 +128,17 @@ $result = $renderer->render($differ);
123
128
</table >
124
129
125
130
126
- ## Renderer: Inline
131
+ ### Renderer: Inline
127
132
128
133
![ Inline] ( https://raw.githubusercontent.com/jfcherng/php-diff/v6/example/images/inline-renderer.png )
129
134
130
135
131
- ## Renderer: Side By Side
136
+ ### Renderer: Side By Side
132
137
133
138
![ Side By Side] ( https://raw.githubusercontent.com/jfcherng/php-diff/v6/example/images/side-by-side-renderer.png )
134
139
135
140
136
- ## Renderer: Unified
141
+ ### Renderer: Unified
137
142
138
143
``` diff
139
144
@@ -1,3 +1,4 @@
@@ -153,7 +158,9 @@ $result = $renderer->render($differ);
153
158
```
154
159
155
160
156
- ## Renderer: Context
161
+ ### Renderer: Context
162
+
163
+ <details ><summary >Click to expand</summary >
157
164
158
165
```
159
166
***************
@@ -182,8 +189,10 @@ $result = $renderer->render($differ);
182
189
Say hello to my neighbors.
183
190
```
184
191
192
+ </details >
185
193
186
- ## Renderer: JSON
194
+
195
+ ### Renderer: JSON
187
196
188
197
<details ><summary >Click to expand</summary >
189
198
@@ -328,17 +337,12 @@ $result = $renderer->render($differ);
328
337
]
329
338
]
330
339
```
340
+
331
341
</details >
332
342
333
343
334
- # Acknowledgment
344
+ ## Acknowledgment
335
345
336
346
This package is built on the top of [ chrisboulton/php-diff] ( https://github.com/chrisboulton/php-diff ) initially.
337
347
But the original repository looks like no longer maintained.
338
348
Here have been quite lots of rewrites and new features since then, hence I re-started this as a new package for better visibility.
339
-
340
-
341
- Supporters <a href =" https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ATXYY9Y78EQ3Y " target =" _blank " ><img src =" https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif " /></a >
342
- ==========
343
-
344
- Thank you guys for sending me some cups of coffee.
0 commit comments