Ok…. title of this post is a tad specific but I have wasted so much time trying to piece all together all the elements of this short post that I thought it will be probably useful for a few other people out there.

 

so what are we talking about anyway.

On one side of the ring we have Nextcloud – the evolution of owncloud, forked by its own founder to ensure this project remain opensource forever (full story here).

Nextcloud allow external app to connect to its API using Webdav, a good old reliable standard.

And on the other side, we have a filesystem abstraction for PHP, named Flysystem, which is super dope and deal with all kind of filesystem with a unified API, and that’s great.

Then we have Laravel the flexible PHP framework, which has a pretty good community of users.

There is a Laravel package for Flysystem, it was made by Graham Campbell and it’s available on Github here.

So, what you do, in your laravel project, you install first Graham Campbell package, as described on the Readme:

The in the config/flysystem.php you edit the connector with your cloud URL (just the nexcloud root install – without the remote.php/webdav etc.)

 

And then in your controller, there you need to specify the remote.php/webdav/

 

and that’s it.

 

(of course, don’t forget to call for

use GrahamCampbell\Flysystem\Facades\Flysystem;

in your controller, but this was kinda documented anyway).

 

so that’s it.

 

Thanks to Gert for the tip on Github here.