PHP code example of okapi / filesystem
1. Go to this page and download the library: Download okapi/filesystem 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/ */
okapi / filesystem example snippets
use Okapi\Filesystem\Filesystem;
// Write file
Filesystem::writeFile('./path/to/file.txt', 'Hello World!');
// Read file
$contents = Filesystem::readFile('./path/to/file.txt');
// Remove directory or file
Filesystem::rm(
'./path',
recursive: true,
force: true,
);
// Create directory
Filesystem::mkdir(
'./path/to/directory',
recursive: true,
mode: 0777,
);