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

Plugins pass-through.

Parameters

string $method
array $arguments

Throws

\BadMethodCallException

Returns

mixed

has()

has(string  $path) : boolean

Check whether a file exists.

Parameters

string $path

Returns

boolean

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.

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.

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.

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.

Returns

string|false —

The file contents, or 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.

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.

Returns

boolean —

True on success, false on failure.

read()

read(string  $path) : string|false

Read a file.

Parameters

string $path

The path to the file.

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.

Returns

resource|false —

The path resource or 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.

Returns

boolean —

True on success, false on failure.

copy()

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

Copy a file.

Parameters

string $path

Path to the existing file.

string $newpath

The new path of the file.

Returns

boolean —

True on success, false on failure.

delete()

delete(string  $path) : boolean

Delete a file.

Parameters

string $path

Returns

boolean —

True on success, false on failure.

deleteDir()

deleteDir(string  $dirname) : boolean

Delete a directory.

Parameters

string $dirname

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.

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.

Returns

array —

A list of file metadata.

getMimetype()

getMimetype(string  $path) : string|false

Get a file's mime-type.

Parameters

string $path

The path to the file.

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.

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.

Returns

string|false —

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

getSize()

getSize(string  $path) : integer|false

Get a file's size.

Parameters

string $path

The path to the file.

Returns

integer|false —

The file size or 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'.

Returns

boolean —

True on success, false on failure.

getMetadata()

getMetadata(string  $path) : array|false

Get a file's metadata.

Parameters

string $path

The path to the file.

Returns

array|false —

The file metadata 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.

assertPresent()

assertPresent(string  $path) : void

Assert a file is present.

Parameters

string $path

path to file

Throws

\League\Flysystem\FileNotFoundException

assertAbsent()

assertAbsent(string  $path) : void

Assert a file is absent.

Parameters

string $path

path to file

Throws

\League\Flysystem\FileExistsException

getWithMetadata()

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

Parameters

string $path
array $metadata

Returns

array

forceCopy()

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

Parameters

string $path
string $newpath

Returns

boolean

forceRename()

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

Parameters

string $path
string $newpath

Returns

boolean

listFiles()

listFiles(string  $path = '', boolean  $recursive = false) : array

Parameters

string $path
boolean $recursive

Returns

array

listPaths()

listPaths(string  $path = '', boolean  $recursive = false) : array

Parameters

string $path
boolean $recursive

Returns

array

listWith()

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

Parameters

array $keys
mixed $directory
mixed $recursive

Returns

array

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