1. Go to this page and download the library: Download pollen-solutions/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/ */
use Pollen\Filesystem\StorageManagerInterface;
/** @var StorageManagerInterface $storage */
$storage->registerLocalDisk('my-local-disk', '/my/local/directory/absolute_path');
use Pollen\Filesystem\LocalFilesystem;
use Pollen\Filesystem\StorageManagerInterface;
/** @var StorageManagerInterface $storage */
$filesystem = new LocalFilesystem($storage->createLocalAdapter('/my/local/directory/absolute_path'));
$storage->addDisk('my-local-disk', $filesystem);
use Pollen\Filesystem\LocalFilesystemAdapter;
use Pollen\Filesystem\LocalFilesystem;
use Pollen\Filesystem\StorageManagerInterface;
/** @var StorageManagerInterface $storage */
$adapter = new LocalFilesystemAdapter('/my/local/directory/absolute_path');
$filesystem = new LocalFilesystem($adapter);
$storage->addDisk('my-local-disk', $localDisk);
use Pollen\Filesystem\StorageManagerInterface;
/** @var StorageManagerInterface $storage */
$disk = $storage->registerLocalDisk('my-local-disk', '/my/local/directory/absolute_path');
// Returns the HTTP response to download a file.
$disk->downloadResponse('/sample.txt');
// Returns the HTTP binary file response to download a file.
$disk->binaryFileResponse('/sample.txt');
// Returns the url of a file or a directory.
$disk->getUrl('/sample.txt')
// Gets the absolute path of a file or a directory.
$disk->getAbsolutePath('/sample.txt');
// Gets the SplFileInfo instance of a file or a directory.
$disk->getSplFileInfo('/sample.txt');
// Gets the storage file attributes of a file or a directory.
$disk->getStorageAttributes('/sample.txt');
use Pollen\Filesystem\LocalImageFilesystem;
use Pollen\Filesystem\StorageManagerInterface;
/** @var StorageManagerInterface $storage */
$filesystem = new LocalImageFilesystem($storage->createLocalAdapter('/my/image/directory/absolute_path'));
$storage->addLocalDisk('my-image-disk', $filesystem);
use Pollen\Filesystem\StorageManagerInterface;
/** @var StorageManagerInterface $storage */
$disk = $storage->registerLocalImageDisk('my-image-disk', '/my/image/directory/absolute_path'));
// Gets the HTML render of an image file from its path.
$disk->HtmlRender('/sample.jpg');
// Gets the image file url from its path.
$disk->getImgSrc('/sample.jpg');