- What is justus/flysystem-onedrive and what is it used for?
- It is a Flysystem v3 adapter that lets PHP and Laravel applications read, write, list, and delete files stored in Microsoft OneDrive or SharePoint document libraries through the Microsoft Graph API. Because Laravel's Storage facade is a thin wrapper over Flysystem, the adapter gives you a familiar filesystem API instead of raw Graph HTTP calls. It fits best when your data already lives in Microsoft 365, such as document vaults, tenant-scoped user uploads, or exports business users expect to see in OneDrive.
- How do I install justus/flysystem-onedrive with Composer?
- Install it with composer require justus/flysystem-onedrive alongside flysystem/flysystem version 3. There is no Laravel service provider shipped, so you wire it up yourself in a service provider using Storage::extend('onedrive', ...) and add a disk entry in config/filesystems.php. Composer handles the rest, and the disk then works like any other Laravel filesystem disk.
- How do I register the OneDrive driver as a Laravel storage disk?
- Create a custom driver by calling Storage::extend('onedrive', function ($app, $config) { ... }) inside a service provider's boot method, returning a Flysystem FilesystemAdapter built on the OneDrive adapter. Add a matching disk block to config/filesystems.php with your tenant ID, client ID, client secret, and drive ID, then access it with Storage::disk('onedrive'). No application code changes are needed beyond that thin glue layer.
- What Azure AD setup and permissions does the OneDrive adapter require?
- You need an Azure AD app registration with either a client secret or certificate, plus Graph API permissions such as Files.ReadWrite.All for application-level access or Files.ReadWrite for delegated access. Application-level permissions require tenant-wide admin consent, so plan for Azure administration work before writing any code. The setup is mostly an identity and consent exercise rather than a development task.
- Does the adapter support uploading large files over the Microsoft Graph limit?
- Microsoft Graph simple uploads are capped at roughly 250 MB, and anything larger must go through chunked upload sessions. Whether this adapter handles that for you depends on its implementation, so verify the source and test with files above the ceiling before committing. If upload sessions are not supported, the safest workaround is to pre-split or restrict file sizes at the application layer.
- Which Laravel and PHP versions work with this Flysystem OneDrive driver?
- The realistic target is Laravel 9 through 12 on Flysystem 3 and PHP 8.1 or newer. Flysystem 1 and 2 use a different contract and are not supported by the v3 adapter line, so any legacy disks need a separate migration path. Verify the constraints in the package's composer.json against the versions you actually run before adopting it.
- How does the adapter handle Microsoft Graph errors like 429 throttling or 401 auth failures?
- Graph returns meaningful status codes such as 401, 403, 423, 429, and 507, and a good adapter maps them into Flysystem exceptions so your application can react. The critical behavior to check is whether 429 Retry-After values are honored with backoff, because OneDrive throttles aggressively under load. Also confirm that token caching and refresh are correct, otherwise you will generate auth storms and more throttling.
- Does this OneDrive adapter support url(), temporaryUrl(), visibility, and mimeType?
- Flysystem's full contract surface includes visibility, MIME detection, checksums, copy and move atomicity, and URL generation, and a small adapter is unlikely to honor all of it. Expect some methods to throw NotSupportedException, which is acceptable as long as your feature set does not depend on them. Decide up front which of these you actually need and test each one against a real tenant.
- How should I test a Laravel app using OneDrive as a storage disk?
- Microsoft Graph has no faithful local emulator, so meaningful integration tests must run against a real tenant with a dedicated test drive. Use Laravel's Storage::fake() for fast unit tests around your own code, and keep a separate integration suite for the adapter's read, write, list, delete, and large-upload paths. Also test path edge cases, since OneDrive paths are case-insensitive, length-capped, and reject reserved characters.
- Is this package safe to depend on in production, and what are the alternatives?
- It is a single-maintainer project with low adoption and no significant dependent corpus, so treat the bus factor as high and budget for a fork on a known timeline. The MIT license lets you take ownership if upstream goes quiet, but you should assume maintenance cost rather than assume fixes will arrive. If you need a battle-tested primary storage disk, Amazon S3 or an S3-compatible store is the safer choice; this adapter makes most sense when Microsoft 365 is already the system of record.