1. Go to this page and download the library: Download oscarweb/file-reporter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
oscarweb / file-reporter example snippets
/* enter correct path */
/**
* Set Directory
* @param string
*/
$app = new FileReporter(__DIR__.DIRECTORY_SEPARATOR.'docs');
/**
* Return data
* @return object - default
*/
$response = $app->getReport();
var_dump($response);
/**
* 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);
$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();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.