1. Go to this page and download the library: Download patterns/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/ */
patterns / filesystem example snippets
namespace Patterns;
interface IFilesystem
{
public function exists(string $path): bool;
public function readFile(string $path): string;
public function writeFile(string $path, string $data): void;
public function deleteFile(string $path): void;
public function readDir(string $path): array; // list<string>, names not paths
public function ensureDir(string $path): void;
public function deleteDir(string $path): void;
}
namespace Patterns;
interface IStatable
{
public function stat(string $path): FileStats;
}
use Patterns\IStatable;
if ($backend instanceof IStatable) {
$size = $backend->stat('reports/2026.json')->size();
}