File: vendor/league/flysystem/docs/

Recommend this page to a friend!
  Classes of Renato De Oliveira Lucena  >  PHP Pokemon Script  >  vendor/league/flysystem/docs/  >  Download  
File: vendor/league/flysystem/docs/
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: PHP Pokemon Script
Provides an API to manage a database of Pokemons
Author: By
Last change:
Date: 3 years ago
Size: 944 bytes


Class file image Download

layout: default permalink: /plugins/ title: Plugins


Need a feature which is not included in Flysystem's bag of tricks? Write a plugin!

use League\Flysystem\FilesystemInterface;
use League\Flysystem\PluginInterface;

class MaximusAwesomeness implements PluginInterface
    protected $filesystem;

    public function setFilesystem(FilesystemInterface $filesystem)
        $this->filesystem = $filesystem;

    public function getMethod()
        return 'getDown';

    public function handle($path = null)
        $contents = $this->filesystem->read($path);

        return sha1($contents);

Now we're ready to use the plugin

use League\Flysystem\Filesystem;
use League\Flysystem\Adapter;

$filesystem = new Filesystem(new Adapter\Local(__DIR__.'/path/to/files/'));
$filesystem->addPlugin(new MaximusAwesomeness);
$sha1 = $filesystem->getDown('path/to/file');

For more information send a message to info at phpclasses dot org.