承接 oscarweb/file-reporter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

oscarweb/file-reporter

Composer 安装命令:

composer require oscarweb/file-reporter

包简介

It is a simple library to create a report of the existing files in an established directory. It has some filters to identify for example: duplicate files or files with the same name.

README 文档

README

It is a simple library to create a report of the existing files in an established directory. It has some filters to identify for example: duplicate files or files with the same name.

Install vía Composer

composer require oscarweb/file-reporter

— Basic use

<?php
/* enter correct path */
require __DIR__.'/../vendor/autoload.php';

use FileReporter\FileReporter;

/**
 * Set Directory
 * @param string
 */
$app = new FileReporter(__DIR__.DIRECTORY_SEPARATOR.'docs');

/**
 * Return data
 * @return object - default
 */
$response = $app->getReport();

var_dump($response);

Output example here

Report JSON Structure: report.md

— Cache

To enable cache, with the previous example you must add the directory path where json files will be saved

/**
 * Set Cache Directory
 * @param string
 */
$app->setCacheDir(__DIR__.DIRECTORY_SEPARATOR.'cache');

/**
 * Return data
 * @return object - default
 */
$response = $app->getReport();

See example here

— control.json

Every time you make a new report and have cache enabled, part of the information will be saved in a control file. You can read the information with the following method.

$app = new FileReporter();

/**
 * @return object - default
 */
$control = $app->getControl();

Output example here

Control JSON Structure: control.md

— Recursive

You can create a custom recursive function.

/**
 * Set Directory
 * @param string
 */
$app = new FileReporter(__DIR__.DIRECTORY_SEPARATOR.'docs');

/**
 * Set Cache Directory
 * @param string
 */
$app->setCacheDir(__DIR__.DIRECTORY_SEPARATOR.'cache');

/**
 * Adjust the output of the json file: JSON_PRETTY_PRINT
 */
$app->setJsonPrettyPrint();

/**
 * Your custom function
 */
function recursive($route, $app){
	$app->setDir($route);
	$result = $app->getReport();

	foreach($result->content as $item){
		if($item->is->dir){
			recursive($item->data->route, $app);
		}
	}
}

recursive($app->getDir(), $app);

See example here

— Filters

You can filter and create file searches based on cached data. It can retrieve repeated files based on the hash value.

$app = new FileReporter(__DIR__.DIRECTORY_SEPARATOR.'docs');

/**
 * If you set cache, it will filter on all reports.
 */
$app->setCacheDir(__DIR__.DIRECTORY_SEPARATOR.'cache');

/**
 * HASH Files - sha1
 * @return object - default
 */
$duplicate_files = $app->filterCache()->repeatsByHash();

See example here

You can see more examples here.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-08-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固