PHP code example of thadbryson / flysystem-fallback
1. Go to this page and download the library: Download thadbryson/flysystem-fallback 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/ */
thadbryson / flysystem-fallback example snippets
use TCB\Flysystem\Fallback;
use TCB\Flysystem\FallbackPlugin;
use League\Flysystem\Filesystem;
use League\Flysystem\Adapter\Local as Adapter;
// So client #1 has their own theme.
$primary = new Filesystem(new Adapter('~/themes/client-1'));
// Let's set the fallbacks in order.
$fallbacks = [
'1' => new Filesystem(new Adapter('~/themes/red')),
'default' => new Filesystem(new Adapter('~/themes/default')),
];
// Add the Plugin.
$primary->addPlugin(new FallbackPlugin());
// You can get the Fallback object from the 'getFallback()' plugin method.
$fallback = $primary->getFallback($fallbacks);
// OR - you can just create the Fallback object directly.
$fallback = new Fallback($primary, $fallbacks);
FALSE