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.
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:
$ composer require graham-campbell/flysystem $ php artisan vendor:publish
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
in your controller, but this was kinda documented anyway).
so that’s it.
Thanks to Gert for the tip on Github here.