1. Go to this page and download the library: Download spoova/filemanager 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/ */
spoova / filemanager example snippets
use Spoova\FileManager\FileManager;
$Filemanager = new FileManager;
$Filemanager->addDir('some/new/dir'); //full path of new directory
$Filemanager->setUrl(__DIR__); //example of setting a url
$Filemanager->openFile($strict, $path); //full path of new directory
$Filemanager->setUrl(__DIR__);
$Filemanager->zipUrl();
if($Filemanager->zipped()) {
echo $Filemanager->lastDir(); //directory of zipped file
} else {
echo "Zip file not created!";
}
$Filemanager->copyTo($newdir, $newname, $strict);
$Filemanger->setUrl(__DIR__);
$Filemanager->zipUrl();
if($Filemanager->zipped()) {
$Filemanager->copyTo('some/new/directory', 'zip_one'); //copy zip file to new directory
}
$Filemanger->setUrl(__DIR__);
$Filemanager->zipUrl();
if($Filemanager->zipped()) {
$new_name = 'mydir.zip';
$Filemanager->moveTo('some/new/directory', $new_name); //move zipped directory file to new path with new name.
}
$Filemanager->move($param1, $param2);
$Filemanger->setUrl(__DIR__.'/'.'folder_or_file_name'); //set a directory or file path
$Filemanger->move(__DIR__.'/destination_directory'); //move to new destination directory
$Filemanger->setUrl(__DIR__); //set a base directory
$Filemanger->move('folder_or_file', __DIR__.'/new_directory'); //move to new existing destination directory
$Filemanger->setUrl(__DIR__);
$Filemanager->zipUrl();
if($Filemanager->zipped()) {
$Filemanager->moveTo('some/new/directory'); //move zipped file to new path
}
$Filemanager->moveTo('some/old/path', 'some/new/path'); // move from some old to new path