PHP code example of struam / dir-rotation
1. Go to this page and download the library: Download struam/dir-rotation 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/ */
struam / dir-rotation example snippets
use Struam\DirRotation\DirRotation;
try {
// Initialization without specifying the working directory
$dirRotation = new DirRotation();
echo "Working Directory: " . $dirRotation->getWorkingDirectory();
// Creating a subdirectory
$subdirectoryPath = $dirRotation->createSubdirectory('dir/new/temp');
echo "Subdirectory created at: " . $subdirectoryPath;
// Archiving a subdirectory followed by deletion
$archivePath = $dirRotation->archiveDirectory('dir/new/temp', true);
echo "Directory archived at: " . $archivePath;
// Changing the working directory
$dirRotation->changeWorkingDirectory('/new/working/directory');
echo "Working Directory changed to: " . $dirRotation->getWorkingDirectory();
} catch (\Exception $e) {
echo "Error: " . $e->getMessage();
}