<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
darkotodoric / efficient-file-management example snippets
// Define the folder path where files will be saved
$baseFolderPath = '/mnt/efficient-file-management/';
// Define allowed extensions
$allowedExtensions = ['json', 'xml', 'txt'];
// Define the division number (Maximum number of files in one folder)
$divisionNumber = 50000;
$efficientFileManagement = new EfficientFileManagement($baseFolderPath, $allowedExtensions, $divisionNumber);
// Get IDs from MySQL or other data source
$ids = [1337, 5162, 70312, 155312, 160312, 525312];
// Save content
foreach ($ids as $id) {
$data = json_encode(['name' => 'File with ID ' . $id]);
$efficientFileManagement->saveContent($id, 'json', $data);
}
// Get content
foreach($ids as $id){
$data = $efficientFileManagement->getContent($id, 'json');
}
// Delete content
foreach($ids as $id){
$data = json_encode(['name' => 'File with ID ' . $id]);
$efficientFileManagement->deleteContent($id, 'json');
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.