Setup / Bootstrap

As explained in the architecture description, Flysystem uses the adapter pattern. This means you’ll always need an adapter, which needs to be wrapped in a Filesystem instance.

Adapter Setup

Each adapter has their own setup and dependencies. For each adapter a setup guide is provided. You can find the guides in the adapters section in the menu.

For this example we’ll use the local adapter:


use League\Flysystem\Adapter\Local;

$adapter = new Local(__DIR__.'/path/to/root/');

Setup Filesystem

Now that you’ve got your adapter setup you can use it to create the filesystem:


use League\Flysystem\Filesystem;

$filesystem = new Filesystem($adapter);

Global Configuration

Adapters each have their own configuration. Apart from adapter constructors configuration options can be provided in global configuration through the Filesystem.


use League\Flysystem\Filesystem;

$filesystem = new Filesystem($adapter, ['visibility' => 'public']);

The global available configuration options are:

option description type
visibility default visibility string