THE REPO IS UNMAINTAINED.
bsdiff for php extension 二进制差异包工具php扩展
- 对新旧两个文件的二进制对比,生成差异文件;
- 使用旧文件和差异包生成新文件
bzip2 http://www.bzip.org/downloads.html
Download bzip2 and use make && make install
- git clone https://github.com/EagleWu/phpdiff.git
- cd phpdiff
- phpize
- export LDFLAGS="-lbz2" && ./configure --with-php-config=/php-path/bin/php-config
- make && make install
- echo "extension=phpdiff.so" >> /php-path/etc/php.ini
<?php
//being create the diff.patch file
bsdiff('oldfile.txt', 'newfile.txt', 'diff.patch');
<?php
//being create newfile with the above diff.patch
bspatch('oldfile.txt', 'newfile_with_patch.txt', 'diff.patch');
eagle@Macbok-Pro:[~/Source/phpdiff]$tree demo/
demo/
├── diff.php
├── newfile.txt
├── oldfile.txt
└── patch.php
0 directories, 4 files