n3xt0r/laravel-webdav-server

A WebDAV server implementation for Laravel based on SabreDAV, with support for Laravel filesystem disks.

Maintainers

Package info

github.com/N3XT0R/laravel-webdav-server

Homepage

pkg:composer/n3xt0r/laravel-webdav-server

Fund package maintenance!

N3XT0R

Statistics

Installs: 206

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0


README

Latest Version on Packagist Security Rating Develop Status GitHub Tests Action Status Read the Docs Maintainability Code Coverage Enterprise Ready

A WebDAV server package for Laravel powered by SabreDAV and Laravel Flysystem.

It exposes Laravel storage disks through /webdav/{space}/{path?} and maps each request to a configured storage space with a user-scoped root path.

Laravel WebDAV Server Logo

Documentation

The full documentation is available on Read the Docs:

👉 https://laravel-webdav-server.readthedocs.io/en/stable/

The same documentation is also available in this repository:

👉 docs/

Read the Docs provides a structured and navigable version of the same content.

Useful entry points:

The Problem

  • Laravel does not provide a native WebDAV server.
  • Many existing packages provide WebDAV clients, for example for Flysystem, but not a server.
  • Thin SabreDAV integrations often behave like black boxes inside Laravel.
  • Request flow, authentication, storage resolution, and routing are often difficult to inspect or influence.
  • Customization often requires replacing large parts of the integration.
  • Debugging is difficult because many WebDAV clients return generic errors or no useful diagnostics.
  • Client behavior differs noticeably between Windows Explorer, macOS Finder, and WinSCP.
  • Windows WebClient is especially strict about OPTIONS, PROPFIND, and response correctness.

This package integrates WebDAV cleanly into a modern Laravel architecture.

What This Package Provides

  • a WebDAV server for Laravel
  • an explicit request pipeline
  • Laravel Flysystem integration for storage
  • Laravel Gate / policy-based authorization by default
  • structured storage mapping through spaces
  • defined contracts and extension points instead of a black-box runtime
  • WebDavPath Facade for resolving WebDAV mount URLs and user storage paths from controllers, views, and jobs — without triggering the WebDAV pipeline
  • Laravel events for WebDAV mutations such as file and directory create, update, and delete
  • events are dispatched after successful operations, so applications can integrate cleanly without internal overrides or hooks
  • logging for authentication, routing, storage resolution, and server behavior
  • WebDAV behavior compatible with common clients, including Windows WebClient

Quickstart

docker compose up --build -d
docker compose exec php composer run serve

Default endpoint:

http://localhost:8000/webdav/default/

Seeded workbench credentials:

Username: testuser
Password: password

Quick verification:

curl -u testuser:password -X PROPFIND http://localhost:8000/webdav/default/

For full setup and configuration details, use the documentation links above.

Installation

composer require n3xt0r/laravel-webdav-server
php artisan vendor:publish --tag="laravel-webdav-server-config"
php artisan migrate

The package service provider is N3XT0R\LaravelWebdavServer\WebdavServerServiceProvider.

Core Concepts

  • Route shape: /webdav/{space}/{path?}
  • Authentication: HTTP Basic Auth
  • Storage mapping: configured spaces
  • Authorization: PathAuthorizationInterface, backed by Laravel Gate / policies by default

See Read the Docs for the complete request flow, configuration reference, and extension model.

WebDavPath Facade

Resolve WebDAV connection details for users without going through the WebDAV pipeline:

use N3XT0R\LaravelWebdavServer\Facades\WebDavPath;
use N3XT0R\LaravelWebdavServer\Contracts\Repositories\AccountRepositoryInterface;

// Mount URL — same for every user of a space
$url = WebDavPath::resolveUrl('default');
// → 'https://your-app.test/webdav/default'

// User-scoped storage path — pass the WebDAV account from the repository
$account = app(AccountRepositoryInterface::class)->findEnabledByUsername($username);
$path = WebDavPath::resolvePath($account, 'default');
// → 'webdav/42'

See Path Resolution for the full reference.

Compatibility Notes

  • The package implements WebDAV behavior compatible with common clients, including Windows WebClient.
  • Windows WebClient depends on correct OPTIONS handling, valid PROPFIND responses, valid 207 Multi-Status responses, root collection handling, and MS-Author-Via: DAV.
  • Prefer https://, especially for Windows clients.
  • Client-side constraints such as system configuration, local policy, and http:// versus https:// still apply.

Developer Commands

composer run test
composer run lint
composer run test:lint
composer run serve

License

MIT License