How to use FlySystem for storage in a NextCloud app?

I am developing an app that needs to read and write files. Part of my code is provided by a library that uses FlySystem. In the NextCloud codebase there is a FlySystem class:

https://github.com/nextcloud/server/blob/master/lib/private/Files/Storage/Flysystem.php

The code says it is a

Generic adapter between flysystem adapters and owncloud’s storage system

That sounds exactly like what I need!

But how do I use it? I couldn’t really find any documentation about that…

As it turned out, there wasn’t any Flysystem adapter to use the FlySystem API within Nextcloud.

The existing class in /lib/private/Files/Storage/Flysystem.php is meant/used to allow Nextcloud to talk to an external storage location.

In the end, we created our own Adapter to allow working within Nextcloud using the Flysystem API: pdsinterop/flysystem-nextcloud

1 Like