<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
brianhenryie / bh-php-flysystem-readonly example snippets
use BrianHenryIE\FlysystemReadOnly\ReadOnlyFileSystemAdapter;
use League\Flysystem\Filesystem;
use League\Flysystem\Local\LocalFilesystemAdapter;
$adapter = new LocalFilesystemAdapter('/path/to/project');
if ($isDryRun) {
$adapter = new ReadOnlyFileSystemAdapter($adapter);
}
$filesystem = new Filesystem($adapter);
$filesystem->write('src/Example.php', ' // rewritten');
// The new content is visible...
echo $filesystem->read('src/Example.php');
// // rewritten
// ...but the file on disk is untouched.
echo file_get_contents('/path/to/project/src/Example.php');
// Warning: file_get_contents(/path/to/project/src/Example.php): failed to open stream: No such file or directory in Command line code on line 1
$adapter = new ReadOnlyFileSystemAdapter($localAdapter, $myPathNormalizer);
class MyAdapter extends SomeAdapter implements FlysystemAdapterBackCompatTraitInterface
{
use FlysystemAdapterBackCompatTrait;
public function normalizePath(string $path): string
{
return (new WhitespacePathNormalizer())->normalizePath($path);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.