定制 hack4mer/diffon 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hack4mer/diffon

Composer 安装命令:

composer require hack4mer/diffon

包简介

A PHP library to find the differences between two given directories

README 文档

README

A PHP library to find the differences between two given directories

Gives following information about the directories:

  • Files/Directories that exist in the first directory only.
  • Files/Directories that exist in second directory only.
  • Files/Directories that exist in both the directories.
  • Files that exist in both the directories, but contain different data.

But, what about directories that exist in both the directories and contain different things? For that, we should implement Diffon with recursion in our code.

Installation

composer require hack4mer/diffon

Usage

Let's say you have two directories with following content:

dir1 => hack4mer.txt, github.txt, winter.txt
dir2 => hack4mer.txt (with different content), github.txt, summer.txt

To compare the directories with Diffon:

<?php
//include composer autoloader
include 'vendor/autoload.php'
use Hack4mer\Diffon\Dinffon;

$diffon = new Diffon();
$diffon->setSource("dir1")->setDestination("dir2");
$difference = $diffon->diff();

print_r($difference);
?>

Output:

Array
(
    [only_in_source] => Array
        (
            [2] => winter.txt
        )

    [only_in_destination] => Array
        (
            [2] => summer.txt
        )

    [in_both] => Array
        (
            [0] => github.txt
            [1] => hack4mer.txt
        )

    [not_same] => Array
        (
            [1] => hack4mer.txt
        )

)

Notice the index of the array elements, they give information about the position of each file in given directories if sorted alphabetically.

统计信息

  • 总下载量: 22
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-10-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固