1. Go to this page and download the library: Download jardisadapter/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/ */
jardisadapter / filesystem example snippets
use JardisAdapter\Filesystem\FilesystemService;
$service = new FilesystemService();
$fs = $service->local('/var/app/storage');
$fs->write('uploads/photo.jpg', $imageData);
$content = $fs->read('uploads/photo.jpg');
new S3Config(
bucket: 'my-bucket', // key: 'AKIAEXAMPLE', // azonaws.com', // default: AWS (use custom for MinIO etc.)
prefix: 'uploads/', // path prefix in bucket (default: '')
)
use JardisAdapter\Filesystem\Exception\FileNotFoundException;
use JardisSupport\Contract\Filesystem\FilesystemExceptionInterface;
try {
$content = $fs->read('missing.txt');
} catch (FileNotFoundException $e) {
// file does not exist
} catch (FilesystemExceptionInterface $e) {
// any other filesystem error
}
// Inject read-only access
public function __construct(
private readonly FilesystemReaderInterface $storage,
) {}