PHP code example of league / flysystem-adapter-decorator
1. Go to this page and download the library: Download league/flysystem-adapter-decorator 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/ */
league / flysystem-adapter-decorator example snippets
php
use League\Flysystem\AdapterDecorator\DecoratorTrait;
use League\Flysystem\AdapterInterface;
use League\Flysystem\Config;
class MyDecorator implements AdapterInterface
{
use DecoratorTrait;
protected $adapter;
public function __construct(AdapterInterface $adapter)
{
$this->adapter = $adapter;
}
// Required method to implement
protected function getDecoratedAdapter()
{
return $this->adapter;
}
// Add your decorator methods here...
public function write($path, $contents, Config $config)
{
$contents = funky_encryption($contents);
return $this->getDecoratedAdapter()->write($path, $contents, $config);
}
}
php
use League\Flysystem\Adapter\Local;
use League\Flysystem\Filesystem;
$adapter = new Local($root);
$decoratedAdapter = new MyDecorator($adapter);
$filesystem = new Filesystem($decoratedAdapter);
// Use the Flysystem as you normally would.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.