madhankumar / directory-manager
A PHP package for directory and file management
v1.0.1
2024-12-18 09:46 UTC
Requires
- php: >=7.4
This package is auto-updated.
Last update: 2025-05-20 06:07:39 UTC
README
A PHP package for manage your directory
Setup
Ensure you have composer installed, then run the following command:
composer require madhankumar/directory-manager
That will fetch the library and its dependencies inside your vendor folder. Then you can add the following to your .php files in order to use the library
require_once __DIR__.'/vendor/autoload.php';
Then you need to use
the relevant classes:
use Madhankumar\DirectoryManager\DirectoryManager;
Usage
$directoryManager = new DirectoryManager();
List all folders and files in the given path:
$this->directoryManager->listDirectory("/var/www/html");
The above function list all folders and files in the below format
{ "folders": [ // Array { "id": int, "name": string, // Folder name "size": int, // Folder size "created_time": string, // Folder created date timestamp in the format of Y-m-d HH:mm:ss "modified_time": string, // Folder modified date timestamp in the format of Y-m-d HH:mm:ss "created_timestamp": int, // timestamp "modified_timestamp": int, // timestamp }, ... ], "files": [ // Array { "id": int, "name": string, // File name "path": string, // File full path "size": int, // File size "created_time": string, // Folder created date timestamp in the format of Y-m-d HH:mm:ss "modified_time": string, // Folder modified date timestamp in the format of Y-m-d HH:mm:ss "created_timestamp": int, // timestamp "modified_timestamp": int, // timestamp }, ... ] }
Author: Madhankumar madhantocontact@gmail.com