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(array<mixed,\League\Flysystem\FilesystemInterface>  $filesystems = array()) 

Constructor.

Parameters

array<mixed,\League\Flysystem\FilesystemInterface> $filesystems

[:prefix => Filesystem,]

Throws

\InvalidArgumentException

mountFilesystems()

mountFilesystems(array<mixed,\League\Flysystem\FilesystemInterface>  $filesystems) : $this

Mount filesystems.

Parameters

array<mixed,\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 = '', boolean  $recursive = false) : array

List contents of a directory.

Parameters

string $directory

The directory to list.

boolean $recursive

Whether to list recursively.

Throws

\InvalidArgumentException
\League\Flysystem\FilesystemNotFoundException

Returns

array

copy()

copy(string  $from, string  $to, array  $config = array()) : boolean

Copy a file.

Parameters

string $from
string $to
array $config

Throws

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

Returns

boolean

listWith()

listWith(array  $keys = array(), string  $directory = '', boolean  $recursive = false) : array

List with plugin adapter.

Parameters

array $keys
string $directory
boolean $recursive

Throws

\InvalidArgumentException
\League\Flysystem\FilesystemNotFoundException

Returns

array

move()

move(string  $from, string  $to, array  $config = array()) : boolean

Move a file.

Parameters

string $from
string $to
array $config

Throws

\InvalidArgumentException
\League\Flysystem\FilesystemNotFoundException

Returns

boolean

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) : boolean

Check whether a file exists.

Parameters

string $path

Returns

boolean

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) : integer|false

Get a file's size.

Parameters

string $path

The path to the file.

Throws

\League\Flysystem\FileNotFoundException

Returns

integer|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 = array()) : boolean

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

boolean —

True on success, false on failure.

writeStream()

writeStream(string  $path, resource  $resource, array  $config = array()) : boolean

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

boolean —

True on success, false on failure.

update()

update(string  $path, string  $contents, array  $config = array()) : boolean

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

boolean —

True on success, false on failure.

updateStream()

updateStream(string  $path, resource  $resource, array  $config = array()) : boolean

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

boolean —

True on success, false on failure.

rename()

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

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

boolean —

True on success, false on failure.

delete()

delete(string  $path) : boolean

Delete a file.

Parameters

string $path

Throws

\League\Flysystem\FileNotFoundException

Returns

boolean —

True on success, false on failure.

deleteDir()

deleteDir(string  $dirname) : boolean

Delete a directory.

Parameters

string $dirname

Throws

\League\Flysystem\RootViolationException

Thrown if $dirname is empty.

Returns

boolean —

True on success, false on failure.

createDir()

createDir(string  $dirname, array  $config = array()) : boolean

Create a directory.

Parameters

string $dirname

The name of the new directory.

array $config

An optional configuration array.

Returns

boolean —

True on success, false on failure.

setVisibility()

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

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

boolean —

True on success, false on failure.

put()

put(string  $path, string  $contents, array  $config = array()) : boolean

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

boolean —

True on success, false on failure.

putStream()

putStream(string  $path, resource  $resource, array  $config = array()) : boolean

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

boolean —

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 = false) : array

Parameters

mixed $directory
mixed $recursive

Returns

array

listPaths()

listPaths(mixed  $directory = '', mixed  $recursive = false) : 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(\PluginInterface  $plugin) : \League\Flysystem\Filesystem

Register a plugin.

Parameters

\PluginInterface $plugin

The plugin to register.

Returns

\League\Flysystem\Filesystem

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) : array<mixed,string>

Parameters

string $path

Throws

\InvalidArgumentException

Returns

array<mixed,string> —

[:prefix, :path]