Skip to content

FlySystem Loader

Edit this page

The FlysystemLoader lets you load images using the Flysystem filesystem abstraction layer.

Dependencies

This data loader uses a League\\Flysystem\\Filesystem to load files from any source supported by Flysystem. Flysystem is provided by the league/flysystem package, but the easiest way to set up a service is using one of the flysystem bundles. You can use either OneupFlysystemBundle or The League FlysystemBundle. Both allow you to define filesystems as services, LiipImagineBundle does not care which one you use.

To install the OneupFlysystemBundle, run the following composer command:

1
$ composer require oneup/flysystem-bundle

Configuration

The value of filesystem_service must be a service id of class League\\Flysystem\\Filesystem. The service name depends on the naming scheme of the bundle, for The League FlysystemBundle, it will be different than in the example below.

Using OneupFlysystemBundle, a basic configuration might look as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# /config/liip_imagine.yaml

liip_imagine:
    loaders:
        profile_photos:
            flysystem:
                filesystem_service: oneup_flysystem.profile_photos_filesystem
    data_loader: profile_photos


# /config/oneup_flysystem.yaml

oneup_flysystem:
    adapters:
        profile_photos:
            local:
                location:  "path/to/profile/photos"

    filesystems:
        profile_photos:
            adapter: profile_photos

Using The League FlysystemBundle:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# /config/liip_imagine.yaml

liip_imagine:
    loaders:
        profile_photos:
            flysystem:
                #⚠️ do not use the full flysystem service alias (which would be `flysystem.adapter.profile_photos.storage`) 
                filesystem_service: 'profile_photos.storage'
    data_loader: profile_photos


# /config/flysystem.yaml

flysystem:
    storages:
        profile_photos.storage:
            adapter: 'local'
            options:
                directory:  "path/to/profile/photos"
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.
TOC
    Version