Skip to content

Latest commit

 

History

History
60 lines (57 loc) · 2.03 KB

README.md

File metadata and controls

60 lines (57 loc) · 2.03 KB

PHP Directory manager

Latest Version on Packagist

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