Properties

$plugins

$plugins : array

Type

array

Methods

addPlugin()

addPlugin(\League\Flysystem\PluginInterface  $plugin) : $this

Register a plugin.

Parameters

\League\Flysystem\PluginInterface $plugin

Throws

\LogicException

Returns

$this —

__call()

__call(string  $method, array  $arguments) : mixed

Call forwarder.

Parameters

string $method
array $arguments

Throws

\InvalidArgumentException
\League\Flysystem\FilesystemNotFoundException

Returns

mixed —

__construct()

__construct(\League\Flysystem\FilesystemInterface[]  $filesystems = []) : mixed

Constructor.

Parameters

\League\Flysystem\FilesystemInterface[] $filesystems

[:prefix => Filesystem,]

Throws

\InvalidArgumentException

Returns

mixed —

mountFilesystems()

mountFilesystems(\League\Flysystem\FilesystemInterface[]  $filesystems) : $this

Mount filesystems.

Parameters

\League\Flysystem\FilesystemInterface[] $filesystems

[:prefix => Filesystem,]

Throws

\InvalidArgumentException

Returns

$this —

mountFilesystem()

mountFilesystem(string  $prefix, \League\Flysystem\FilesystemInterface  $filesystem) : $this

Mount filesystems.

Parameters

string $prefix
\League\Flysystem\FilesystemInterface $filesystem

Throws

\InvalidArgumentException

Returns

$this —

getFilesystem()

getFilesystem(string  $prefix) : \League\Flysystem\FilesystemInterface

Get the filesystem with the corresponding prefix.

Parameters

string $prefix

Throws

\League\Flysystem\FilesystemNotFoundException

Returns

\League\Flysystem\FilesystemInterface —

filterPrefix()

filterPrefix(array  $arguments) : array

Retrieve the prefix from an arguments array.

Parameters

array $arguments

Throws

\InvalidArgumentException

Returns

array —

[:prefix, :arguments]

listContents()

listContents(string  $directory = '', bool  $recursive = false) : array

List contents of a directory.

Parameters

string $directory
bool $recursive

Throws

\InvalidArgumentException
\League\Flysystem\FilesystemNotFoundException

Returns

array —

copy()

copy(string  $from, string  $to, array  $config = []) : bool

Copy a file.

Parameters

string $from
string $to
array $config

Throws

\InvalidArgumentException
\League\Flysystem\FilesystemNotFoundException
\League\Flysystem\FileExistsException

Returns

bool —

listWith()

listWith(array  $keys = [], string  $directory = '', bool  $recursive = false) : array

List with plugin adapter.

Parameters

array $keys
string $directory
bool $recursive

Throws

\InvalidArgumentException
\League\Flysystem\FilesystemNotFoundException

Returns

array —

move()

move(string  $from, string  $to, array  $config = []) : bool

Move a file.

Parameters

string $from
string $to
array $config

Throws

\InvalidArgumentException
\League\Flysystem\FilesystemNotFoundException

Returns

bool —

invokePluginOnFilesystem()

invokePluginOnFilesystem(string  $method, array  $arguments, string  $prefix) : mixed

Invoke a plugin on a filesystem mounted on a given prefix.

Parameters

string $method
array $arguments
string $prefix

Throws

\League\Flysystem\FilesystemNotFoundException

Returns

mixed —

has()

has(string  $path) : bool

Check whether a file exists.

Parameters

string $path

Returns

bool —

read()

read(string  $path) : string|false

Read a file.

Parameters

string $path

The path to the file.

Throws

\League\Flysystem\FileNotFoundException

Returns

string|false —

The file contents or false on failure.

readStream()

readStream(string  $path) : resource|false

Retrieves a read-stream for a path.

Parameters

string $path

The path to the file.

Throws

\League\Flysystem\FileNotFoundException

Returns

resource|false —

The path resource or false on failure.

getMetadata()

getMetadata(string  $path) : array|false

Get a file's metadata.

Parameters

string $path

The path to the file.

Throws

\League\Flysystem\FileNotFoundException

Returns

array|false —

The file metadata or false on failure.

getSize()

getSize(string  $path) : int|false

Get a file's size.

Parameters

string $path

The path to the file.

Throws

\League\Flysystem\FileNotFoundException

Returns

int|false —

The file size or false on failure.

getMimetype()

getMimetype(string  $path) : string|false

Get a file's mime-type.

Parameters

string $path

The path to the file.

Throws

\League\Flysystem\FileNotFoundException

Returns

string|false —

The file mime-type or false on failure.

getTimestamp()

getTimestamp(string  $path) : string|false

Get a file's timestamp.

Parameters

string $path

The path to the file.

Throws

\League\Flysystem\FileNotFoundException

Returns

string|false —

The timestamp or false on failure.

getVisibility()

getVisibility(string  $path) : string|false

Get a file's visibility.

Parameters

string $path

The path to the file.

Throws

\League\Flysystem\FileNotFoundException

Returns

string|false —

The visibility (public|private) or false on failure.

write()

write(string  $path, string  $contents, array  $config = []) : bool

Write a new file.

Parameters

string $path

The path of the new file.

string $contents

The file contents.

array $config

An optional configuration array.

Throws

\League\Flysystem\FileExistsException

Returns

bool —

True on success, false on failure.

writeStream()

writeStream(string  $path, resource  $resource, array  $config = []) : bool

Write a new file using a stream.

Parameters

string $path

The path of the new file.

resource $resource

The file handle.

array $config

An optional configuration array.

Throws

\InvalidArgumentException

If $resource is not a file handle.

\League\Flysystem\FileExistsException

Returns

bool —

True on success, false on failure.

update()

update(string  $path, string  $contents, array  $config = []) : bool

Update an existing file.

Parameters

string $path

The path of the existing file.

string $contents

The file contents.

array $config

An optional configuration array.

Throws

\League\Flysystem\FileNotFoundException

Returns

bool —

True on success, false on failure.

updateStream()

updateStream(string  $path, resource  $resource, array  $config = []) : bool

Update an existing file using a stream.

Parameters

string $path

The path of the existing file.

resource $resource

The file handle.

array $config

An optional configuration array.

Throws

\InvalidArgumentException

If $resource is not a file handle.

\League\Flysystem\FileNotFoundException

Returns

bool —

True on success, false on failure.

rename()

rename(string  $path, string  $newpath) : bool

Rename a file.

Parameters

string $path

Path to the existing file.

string $newpath

The new path of the file.

Throws

\League\Flysystem\FileExistsException

Thrown if $newpath exists.

\League\Flysystem\FileNotFoundException

Thrown if $path does not exist.

Returns

bool —

True on success, false on failure.

delete()

delete(string  $path) : bool

Delete a file.

Parameters

string $path

Throws

\League\Flysystem\FileNotFoundException

Returns

bool —

True on success, false on failure.

deleteDir()

deleteDir(string  $dirname) : bool

Delete a directory.

Parameters

string $dirname

Throws

\League\Flysystem\RootViolationException

Thrown if $dirname is empty.

Returns

bool —

True on success, false on failure.

createDir()

createDir(string  $dirname, array  $config = []) : bool

Create a directory.

Parameters

string $dirname

The name of the new directory.

array $config

An optional configuration array.

Returns

bool —

True on success, false on failure.

setVisibility()

setVisibility(string  $path, string  $visibility) : bool

Set the visibility for a file.

Parameters

string $path

The path to the file.

string $visibility

One of 'public' or 'private'.

Throws

\League\Flysystem\FileNotFoundException

Returns

bool —

True on success, false on failure.

put()

put(string  $path, string  $contents, array  $config = []) : bool

Create a file or update if exists.

Parameters

string $path

The path to the file.

string $contents

The file contents.

array $config

An optional configuration array.

Returns

bool —

True on success, false on failure.

putStream()

putStream(string  $path, resource  $resource, array  $config = []) : bool

Create a file or update if exists.

Parameters

string $path

The path to the file.

resource $resource

The file handle.

array $config

An optional configuration array.

Throws

\InvalidArgumentException

Thrown if $resource is not a resource.

Returns

bool —

True on success, false on failure.

readAndDelete()

readAndDelete(string  $path) : string|false

Read and delete a file.

Parameters

string $path

The path to the file.

Throws

\League\Flysystem\FileNotFoundException

Returns

string|false —

The file contents, or false on failure.

get()

get(string  $path, \League\Flysystem\Handler  $handler = null) : \League\Flysystem\Handler

Get a file/directory handler.

Parameters

string $path

The path to the file.

\League\Flysystem\Handler $handler

An optional existing handler to populate.

Returns

\League\Flysystem\Handler —

Either a file or directory handler.

getAdapter()

getAdapter(mixed  $prefix) : \League\Flysystem\AdapterInterface

Parameters

mixed $prefix

Returns

\League\Flysystem\AdapterInterface —

getConfig()

getConfig(mixed  $prefix) : \League\Flysystem\Config

Parameters

mixed $prefix

Returns

\League\Flysystem\Config —

listFiles()

listFiles(mixed  $directory, mixed  $recursive) : array

Parameters

mixed $directory
mixed $recursive

Returns

array —

listPaths()

listPaths(mixed  $directory, mixed  $recursive) : array

Parameters

mixed $directory
mixed $recursive

Returns

array —

getWithMetadata()

getWithMetadata(mixed  $path, array  $metadata) : array

Parameters

mixed $path
array $metadata

Returns

array —

flushCache()

flushCache() : \League\Flysystem\Filesystem

Returns

\League\Flysystem\Filesystem —

assertPresent()

assertPresent(mixed  $path) : void

Parameters

mixed $path

assertAbsent()

assertAbsent(mixed  $path) : void

Parameters

mixed $path

addPlugin()

addPlugin(\League\Flysystem\PluginInterface  $plugin) : $this

Register a plugin.

Parameters

\League\Flysystem\PluginInterface $plugin

The plugin to register.

Returns

$this —

findPlugin()

findPlugin(string  $method) : \League\Flysystem\PluginInterface

Find a specific plugin.

Parameters

string $method

Throws

\League\Flysystem\Plugin\PluginNotFoundException

Returns

\League\Flysystem\PluginInterface —

invokePlugin()

invokePlugin(string  $method, array  $arguments, \League\Flysystem\FilesystemInterface  $filesystem) : mixed

Invoke a plugin by method name.

Parameters

string $method
array $arguments
\League\Flysystem\FilesystemInterface $filesystem

Throws

\League\Flysystem\Plugin\PluginNotFoundException

Returns

mixed —

getPrefixAndPath()

getPrefixAndPath(string  $path) : string[]

Parameters

string $path

Throws

\InvalidArgumentException

Returns

string[] —

[:prefix, :path]