league/flysystem-adapter-decorator
最新稳定版本:1.0.0
Composer 安装命令:
composer require league/flysystem-adapter-decorator
包简介
A base implementation of a flysystem adapter decorator
README 文档
README
This package provides a default adapter decorator. In most cases decorators
only influence a particular part of the interface. The trait provided by
this package provides the default implementation for the methods which the
decorator is not concerned with.
Installation
composer require league/flysystem-adapter-decorator
Creating Decorators
<?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); } }
Using Decorators
<?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.
统计信息
- 总下载量: 133.62k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 1
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-12-23