n3xt0r / laravel-webdav-server
A WebDAV server implementation for Laravel based on SabreDAV, with support for Laravel filesystem disks.
Fund package maintenance!
Requires
- php: ^8.4|^8.5
- illuminate/contracts: ^12.0|^13.0
- sabre/dav: ~4.7.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- brianium/paratest: ^7.20
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^11.1.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- dev-main
- 1.0.0
- 1.0.0-beta.3
- 1.0.0-beta.2
- 1.0.0-beta.1
- 1.0.0-alpha.4
- 1.0.0-alpha.3
- 1.0.0-alpha.2
- 1.0.0-alpha.1
- dev-develop
- dev-feature/optimize
- dev-feature/path-resolver
- dev-feature/events
- dev-docs/rtd
- dev-feature/testing
- dev-feature/optional-browser-listing
- dev-dependabot/github_actions/dependabot/fetch-metadata-3.1.0
- dev-feature/commands
- dev-bugfix/windows
- dev-feature/logging
- dev-refactore/code-to-adr
- dev-refactor/code
- dev-feature/caldav-carddav-extension-plan
This package is auto-updated.
Last update: 2026-04-28 06:26:06 UTC
README
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.
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:
- Getting Started
- Configuration
- Path Resolution
- Events
- Server Customization
- Authentication & Authorization
- Architecture
- Commands
- Common Questions
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
WebDavPathFacade 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
OPTIONShandling, validPROPFINDresponses, valid207 Multi-Statusresponses, root collection handling, andMS-Author-Via: DAV. - Prefer
https://, especially for Windows clients. - Client-side constraints such as system configuration, local policy, and
http://versushttps://still apply.
Developer Commands
composer run test
composer run lint
composer run test:lint
composer run serve
License
MIT License
