fabacab / secure-shred

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

secure-shred

Safely deletes files

Requeriments

PHP 7.1

Installation

composer.json

{
	"require": {
		"danielruf/secure-shred": "^1"
	}
}

Run composer install

Usage

// load autoload composer
require 'vendor/autoload.php';

$shred = new Shred\Shred($n); // $n (optional) <= Number of iterations. Default 3.

$shred->shred('folder/file.txt'); // <= Overwrite and Remove.
$shred->shred('folder/file.txt', false); // <= Only overwrite.

// Check if remove
if ($shred->shred('folder/file.txt')) {
	// The file is truncated & removed.
} else {
	// Impossible to overwrite or remove the file. See filepath & file permissions.
}

secure-shred overwrites 'n' times the file for making it more difficult to recover (Imposible is nothing!). Obviously inspired by shred for linux. If you want to delete large files, or repeat a large number of times this will increase the execution time of the script.

ini_get('max_execution_time'); // Max execution script time in seconds.
set_time_limit($s); // $s => Set max time limit in seconds.

Credits

secure-shred is based on Shred PHP which was created by Dani C.

Released under the MIT license.

About

License:MIT License


Languages

Language:PHP 100.0%