1. Go to this page and download the library: Download lazarusphp/openhandler 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/ */
lazarusphp / openhandler example snippets
composer install lazarusphp/openhandler
// Setting a path within the methods parameters will set the directory root.
// Leaving it blank will default to the folder root.
$filehandler = OpenHandler::create("/var/www/OpenHandler/Structure");
// Make Sure path exists
$filehandler->directory("/Apps/Login");
$filehandler->list("/Apps");
foreach($filehandler->list("/Apps") as $item => $folders)
{
// List code goes here.
}
$filehandler->delete("/Apps/Home/users.env");
$filehandler->delete("/Apps");
$filehandler->prefix("/App/Users",function($handler){
// Use handler at this point to call methods
$handler->directory("/Uploads");
if(isset($_POST["file"]) && $_SERVER["REQUEST_METHOD"] === "POST")
{
// Set the path and the Form Name value.
$handler->upload("Uploads","file");
}
})