Weave Code
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
Dropbox Api

Dropbox Api Laravel Package

spatie/dropbox-api

Minimal PHP client for Dropbox API v2 by Spatie. Provides core endpoints used by their Flysystem Dropbox adapter—create folders, list directories, fetch temporary links, and more. Easy to install via Composer and use with an auth token.

View on GitHub
Deep Wiki
Context7

A minimal implementation of Dropbox API v2

Frequently asked questions about Dropbox Api
How do I install spatie/dropbox-api in a Laravel project?
Run `composer require spatie/dropbox-api` in your project directory. The package has no additional dependencies beyond PHP 8.0+ and Laravel 8+. Store your Dropbox token in `config/services.php` under the `dropbox` key for easy access.
Does this package support Dropbox Business accounts?
Yes, the package fully supports Dropbox Business accounts. Use the same token generation process in the Dropbox App Console, and the client will handle Business API endpoints seamlessly. Ensure your token has the correct permissions for your use case.
Can I use this package with Laravel’s Filesystem (Storage facade)?
Yes, this package is designed to work with Spatie’s `flysystem-dropbox` adapter, allowing you to integrate Dropbox with Laravel’s unified `Storage` facade. Install `spatie/flysystem-dropbox` separately and configure it in your `filesystems.php` config.
How do I handle short-lived Dropbox tokens (OAuth2 refresh flow)?
The package uses the `TokenProvider` interface, which abstracts token management. For OAuth2 refresh flows, integrate with League’s OAuth2 client or implement a custom provider. Store refresh tokens securely and handle token expiration gracefully in your application logic.
What Laravel versions does spatie/dropbox-api support?
The package is compatible with Laravel 8, 9, and 10. It follows Laravel’s semantic versioning and is regularly tested against these versions. Check the package’s changelog or GitHub actions for updates on newer Laravel releases.
How do I mock Dropbox API calls in PHPUnit tests?
Use Guzzle’s `createMockHandler` to mock HTTP responses. For example, create a mock handler for the `listFolder` endpoint and inject it into the `Client` instance. The package’s dependency on Guzzle makes this straightforward, but abstract the client in your tests for cleaner mocking.
Does this package support chunked uploads for large files (>50MB)?
Yes, the package includes methods like `uploadSessionStart` and `uploadSessionFinish` to handle chunked uploads. Implement retry logic for failed sessions, especially in production, and consider exponential backoff to handle rate limits or transient failures.
Can I extend the package to add custom Dropbox API endpoints?
Yes, the package provides `contentEndpointRequest` and `rpcEndpointRequest` methods for custom endpoints. Extend the `Client` class or create a decorator to add unsupported endpoints. Submit pull requests to Spatie if the feature benefits the broader community.
How should I handle Dropbox API rate limits in Laravel?
The package includes basic retry logic for 5xx and 429 errors. For production, implement exponential backoff in your application or use Laravel’s `retry` helper. Monitor your API usage via Dropbox’s developer dashboard and cache responses (e.g., folder listings) using Laravel’s cache.
What are the alternatives to spatie/dropbox-api for Laravel?
Alternatives include the official Dropbox SDK for PHP (unofficial community wrappers) or third-party libraries like `dropbox/dropbox-sdk`. However, Spatie’s package is minimalist, Laravel-optimized, and actively maintained, making it the best choice for most use cases. Evaluate based on your need for Flysystem integration or custom endpoint support.
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.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata