nino/laravel-nextcloud-fs

Laravel Nextcloud Filesystem

1.0.0 2023-12-20 18:08 UTC

This package is auto-updated.

Last update: 2024-04-21 12:55:46 UTC


README

This package provides a Nextcloud driver for Laravel's Filesystem.

It's a wrapper around Flysystem's WebDAV Adapter.

Compatibility

Laravel : 10, 9

PHP : 8.3, 8.2, 8.1

Install

Via Composer

composer require nino/laravel-nextcloud-fs

Usage

Generate a Nextcloud app password on the desired user's account: Settings > Security > Devices & sessions.

Create a nextcloud filesystem disk:

// config/filesystems.php

'disks' => [
	...
    'nextcloud' => [
        'driver'     => 'nextcloud',
        'baseUri'    => 'https://nextcloud.example.org',
        'userName'   => 'laravel',
        'password'   => 'password-generated-by-nextcloud',
        'directory' => '', // optionnal: set a path as visible for nextcloud user defined in userName
    ],
	...
];

Use it as any Laravel filesystem : https://laravel.com/docs/filesystem

use Illuminate\Support\Facades\Storage;
 
Storage::disk('nextcloud')->put('example.txt', 'Contents');

Note that file visibility features aren't supported (it's a WebDAV limitation).

Contributing

Merge requests, bug reports and suggestions are welcome.

Please follow the following rules on your pull requests:

  • One pull request per feature.
  • Make sure each individual commit in your pull request is meaningful.
  • Document any change in behaviour.
  • Update the tests if necessary.

License

This library is licensed under the MIT License. Please read the license file for more information.

It's based on the work of Protone Media : pbmedia/laravel-webdav (also under MIT license).