Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Webdav Server Laravel Package

n3xt0r/laravel-webdav-server

A Laravel package that brings a WebDAV server to your application, letting you expose files and storage over the WebDAV protocol for seamless sync and access from desktop and mobile clients.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install the package with Composer and follow the /docs setup steps (also at https://laravel-webdav-server.readthedocs.io/en/latest/). Publish the package config before anything else — the config defines your spaces, so almost everything downstream depends on it being correct.
  • The release explicitly calls the public API, config structure, route shape and extension points stable, so you can integrate against them without fear of churn.
  • Start by defining one space in config that points at a Flysystem disk, and wire it to a principal (typically a User). The documented path shape is {root}/{prefix}/{principal.id} — verify what that resolves to with the WebDavPath facade before pointing a client at it.
  • First real use case: expose a per-user space over WebDAV and mount it in macOS Finder and Windows Explorer. Testing both is the fastest way to confirm auth, path resolution and OPTIONS handling are correct.
  • Where to look first when something misbehaves:
    1. the published config (spaces, prefix, root),
    2. PathResolverService (what path the package thinks it is serving),
    3. your Gate policies (authorization happens there, not in the package),
    4. the request pipeline contracts (auth → authorization → storage resolution → server config).

Implementation Patterns

  • Spaces as the storage boundary. Model each space as a Flysystem disk/root. Day-to-day, you add a space rather than overriding internals — e.g. one space per tenant, per project, or per user. Keep the prefix convention consistent so PathResolverService output stays predictable.
  • Authorize with Gate policies, not middleware hacks. Implement policies per node/space and let Laravel Gate enforce reads and writes. This is the sanctioned place to encode "user X may write to space Y," and it keeps authorization testable with plain Laravel tests.
  • React to mutations via events, not overrides. Register listeners for file create/update/delete and directory create/delete to handle auditing, search indexing, cache invalidation, notifications or triggering background jobs. This is the intended integration surface and avoids touching the WebDAV runtime.
  • Use WebDavPath outside the request pipeline. Generate mount URLs for a UI ("Open in Finder / Connect to Server" instructions), build storage paths in Artisan commands, jobs and notifications, or assert paths in tests. It removes the temptation to string-concatenate {root}/{prefix}/{id} yourself.
  • Custom SabreDAV plugins via container tags. Register plugins in the container with the package's tag rather than editing server configuration. Good for cross-cutting WebDAV concerns (custom properties, quota plugins, logging plugins). Mind plugin ordering — earlier plugins can short-circuit later ones.
  • Opt into the Browser Plugin for a quick HTML directory listing — genuinely useful in staging for confirming what the WebDAV view of storage looks like without a desktop client. Leave it off in production unless you want that surface exposed.
  • Wrap the package routes with your own middleware (throttle, request logging, IP allow-listing) — the route shape is stable, so this is safe to do. Keep WebDAV routes out of web middleware that assumes sessions/CSRF.
  • Test with real clients, but automate with HTTP tests. Use curl with -X PROPFIND, -X OPTIONS, and Basic auth for fast regression checks on 207 Multi-Status and headers; use Finder/Explorer/WinSCP/Cyberduck for the periodic sanity check the release notes promise compatibility with.

Gotchas and Tips

  • CSRF and sessions will break WebDAV clients. WebDAV traffic is not a browser form post. Ensure the WebDAV routes are not behind VerifyCsrfToken or session-dependent middleware; stick to stateless auth.
  • Basic auth over plain HTTP is the default reality for many WebDAV clients. Terminate TLS at the edge and document it, or clients will silently send credentials in the clear.
  • Multi-server deployments need a shared lock store. SabreDAV's locking behavior assumes a consistent backend; if you run multiple app nodes, audit where locks live before scaling horizontally.
  • Authorization cost on large PROPFINDs. A PROPFIND on a directory can hit your Gate for every child node. Watch query counts on big folders and keep policies cheap (avoid lazy-loading relations per check).
  • Filesystem semantics vary by disk. S3 and similar object stores do not behave like local disks for directory moves, partial writes or atomic renames. Validate your chosen space disks against WebDAV operations clients actually perform (Finder's rename-and-replace is a common surprise).
  • Events fire after successful filesystem operations — that's the guarantee, not "after the HTTP response." If you queue listeners, you are now outside the request's failure boundary; make them idempotent, since clients retry aggressively.
  • Client-generated noise: macOS Finder and Windows Explorer create .DS_Store, ._*, Thumbs.db and desktop.ini. Expect your audit/sync listeners to see them and filter deliberately.
  • Path normalization: WebDAV clients are inconsistent about trailing slashes and URL-encoding of collection names. Always resolve paths through PathResolverService/WebDavPath rather than comparing raw request strings.
  • Debugging 207 responses is awkward — the body is XML multi-status, not a simple error. Log the resolved path plus the Gate result for failures; that combination explains most "it says forbidden/not found" reports faster than reading the XML.
  • Remember config:cache. Changing spaces, prefix or plugins in config requires a cache clear/re-cache in deployed environments; a stale cache here looks exactly like a routing bug.
  • Extend by contract, not by replacement. The release's core promise is "no blackbox runtime" — if you find yourself subclassing core classes, check the contracts first; that's the supported seam and the one that will survive future releases.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console