- Is spatie/dropbox-api a Laravel package or a plain PHP library?
- It is a framework-agnostic PHP client for Dropbox API v2, not a Laravel package. It ships no service provider, facade, publishable config, or auto-discovery, so nothing is registered in your Laravel app automatically. That is intentional: the dependency stays a thin HTTP transport layer that you wire into your own application code. You can use it in Laravel, Symfony, or a plain PHP script without changing anything.
- How do I install and configure spatie/dropbox-api in a Laravel application?
- Install it with composer require spatie/dropbox-api and create an instance of Spatie\Dropbox\Client with an authorization token or a token provider. In Laravel, bind the client as a singleton in a service provider and read the credentials from an env-backed config entry rather than hardcoding them. Then wrap the client in your own adapter class so the vendor namespace never leaks into controllers or domain code. The whole integration is usually a singleton binding, a config block, and one adapter class.
- Which Dropbox API v2 methods does this package actually support?
- The package deliberately covers only what the flysystem-dropbox adapter needs: file upload and download, create and list folders, delete, move and copy, temporary and shared links, search, and chunked uploads. It is a subset of the Dropbox surface, not a completeness layer. Anything beyond that has to go through the raw request escape hatches. Check the Client source for the exact method list rather than relying on the README examples.
- How do I handle Dropbox short-lived access tokens and refresh tokens with spatie/dropbox-api?
- The client supports three auth modes: a static bearer token, your own implementation of the TokenProvider interface, and app key plus secret. Dropbox now issues short-lived access tokens with refresh tokens, so the TokenProvider path is the correct one for anything long-lived. That means you own token persistence, refresh scheduling, and concurrent-refresh safety in your application. Budget engineering time for the auth model, because it is the real integration cost, not the API calls.
- Can I upload large files with chunked upload sessions?
- Yes. The client includes chunked upload support, which is what the Flysystem adapter uses for large files. You start a session, append chunks, and finish the session to commit the file. If your peak file size or monthly transfer volume is large, verify the chunk size and session handling against the Client source before designing your upload flow.
- How do I call a Dropbox endpoint that this package does not implement?
- The client exposes rpcEndpointRequest() and contentEndpointRequest() as escape hatches, plus a subdomain:: prefix convention for content endpoints. You pass the endpoint path and an untyped array payload, and you get an untyped array back. That works, but it shifts contract ownership onto you: no validation, no typed responses, and no IDE help. Wrap those raw calls in your own adapter methods so the untyped arrays stay in one place.
- Does spatie/dropbox-api support Dropbox webhooks or change notifications?
- No. The package has no webhook receiver, no signature verification, and no cursor management. If you need change notifications you would build the receiver, verification, and cursor persistence yourself on top of the raw endpoint helpers. Confirm early whether change notification is actually in scope, because it is a meaningful piece of work rather than a config flag.
- How do I test code that uses spatie/dropbox-api?
- Because the client is plain PHP with no framework coupling, the cleanest approach is to define your own storage interface, implement it with the Spatie client, and bind a fake in your test container. That keeps your test suite independent of Dropbox and of the package's method list. The package itself ships its own test suite, and since it is Guzzle-based you can also intercept HTTP traffic with a Guzzle mock handler where the underlying client is injectable.
- How does spatie/dropbox-api handle rate limits, retries, and API errors?
- Retry on 5xx responses and 429 rate limits is built into the package, having moved in-package in version 1.10.0, so you get baseline resilience without writing your own middleware. Failures surface as exceptions carrying the Dropbox error code and a response object. Mapping those into application-meaningful outcomes such as Conflict, RateLimited, TokenRevoked, or NotFound is your responsibility, and it is worth doing deliberately rather than letting vendor exceptions bubble up.
- Is spatie/dropbox-api actively maintained, and what are the alternatives?
- It is maintained by Spatie, a long-lived and well-regarded shop, but it is a small utility package in a large portfolio rather than a platform bet, and it follows Dropbox API changes with some lag. Some public health signals around it are unreliable, so judge it by the source and its test badges instead. The main alternatives are the official Dropbox PHP SDK, which is heavier but broader, and using spatie/flysystem-dropbox if you only need filesystem semantics. For a narrow, well-wrapped transport layer it is a reasonable choice; for team-scoped admin actions or Paper and Sign APIs you will need something wider.