1. Go to this page and download the library: Download phpdot/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/ */
phpdot / filesystem example snippets
$grant = $fs->presignedUpload('avatars/42.png', new DateTimeImmutable('+10 minutes'), 'image/png', null, $expectedBytes);
// hand $grant->toArray() to your endpoint; the client then does:
// PUT $grant['url'] with headers: $grant['headers'], body: the file
$session = $manager->create('videos/clip.mp4', $totalBytes); // server mints uploadId + session
$grant = $fs->presignedPartUpload('videos/clip.mp4', $session->uploadId, $n, new DateTimeImmutable('+10 minutes'), 'video/mp4', null, $partBytes);
// client PUTs part $n directly; every part but the last must clear the storage minimum (5 MiB on S3)
$manager->complete($session->id); // built from the bucket's own part list — the client holds no ETags
$fs->checksum('avatars/42.png', 'sha256'); // HeadObject with x-amz-checksum-mode: ENABLED
use Nyholm\Psr7\Factory\Psr17Factory;
use PHPdot\Filesystem\Adapter\LocalAdapter;
use PHPdot\Filesystem\Filesystem;
use PHPdot\Filesystem\FilesystemConfig;
use PHPdot\Filesystem\Write\WriteContents;
$psr17 = new Psr17Factory();
$adapter = new LocalAdapter(new FilesystemConfig(root: '/var/storage'), $psr17);
$filesystem = new Filesystem($adapter, new WriteContents($psr17));
$filesystem->write('invoices/2026.pdf', $pdfBytes); // string | PSR-7 stream | UploadedFile
$pdf = $filesystem->read('invoices/2026.pdf');
$url = $filesystem->url('invoices/2026.pdf'); // public or presigned, by visibility
foreach ($filesystem->listContents('invoices', deep: true) as $entry) {
echo $entry->path(), PHP_EOL;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.