PHPackages                             hamidsamak/dropbox-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. hamidsamak/dropbox-api

ActiveLibrary[API Development](/categories/api)

hamidsamak/dropbox-api
======================

A minimal implementation of Dropbox API v2 with syncing

v1.0.0(3y ago)05MITPHPPHP ^7.1|^8.0

Since Aug 7Pushed 3y agoCompare

[ Source](https://github.com/hamidsamak/dropbox-api)[ Packagist](https://packagist.org/packages/hamidsamak/dropbox-api)[ Docs](https://github.com/hamidsamak/dropbox-api)[ Fund](https://spatie.be/open-source/support-us)[ GitHub Sponsors](https://github.com/spatie)[ RSS](/packages/hamidsamak-dropbox-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

[![](https://camo.githubusercontent.com/2bedf63f24cda7efab02da955dc11fb7ef8a060e2f26b73c33a7aac84529b8a3/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f737570706f72742d756b7261696e652e7376673f743d31)](https://supportukrainenow.org)

A minimal implementation of Dropbox API v2
==========================================

[](#a-minimal-implementation-of-dropbox-api-v2)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3ca9ad2c0d29e96d737a1fbb1de5009060bfd99114f8710a2b5a480db7f29808/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f64726f70626f782d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/dropbox-api)[![GitHub Tests Action Status](https://camo.githubusercontent.com/cc01ea9d2e4fab232c50618535a6ac592ded671df6eafa4dd7fd889a83c0fb58/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f64726f70626f782d6170692f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/spatie/dropbox-api/actions?query=workflow%3ATests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/52680e1460dcd3a12c727a6a8c985eb1f03c40d55b951d2e243f57e9cc3ff707/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f64726f70626f782d6170692f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/spatie/dropbox-api/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/714c253398314e9e4f159473da3339cff992cc4a221d28bb609bb6bbf1fe903e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f64726f70626f782d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/dropbox-api)

This is a minimal PHP implementation of the [Dropbox API v2](https://www.dropbox.com/developers/documentation/http/overview). It contains only the methods needed for [our flysystem-dropbox adapter](https://github.com/spatie/flysystem-dropbox). We are open however to PRs that add extra methods to the client.

Here are a few examples on how you can use the package:

```
$client = new Spatie\Dropbox\Client($authorizationToken);

//create a folder
$client->createFolder($path);

//list a folder
$client->listFolder($path);

//get a temporary link
$client->getTemporaryLink($path);
```

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/b0b7dcd2b1f97b3ef28202371174e1f17fb1e2651c8041cbaa8f78baa6545ff7/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f64726f70626f782d6170692e6a70673f743d31)](https://spatie.be/github-ad-click/dropbox-api)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require spatie/dropbox-api
```

Usage
-----

[](#usage)

The first thing you need to do is get an authorization token at Dropbox. Unlike [other companies](https://google.com) Dropbox has made this very easy. You can just generate a token in the [App Console](https://www.dropbox.com/developers/apps) for any Dropbox API app. You'll find more info at [the Dropbox Developer Blog](https://blogs.dropbox.com/developers/2014/05/generate-an-access-token-for-your-own-account/).

With an authorization token you can instantiate a `Spatie\Dropbox\Client`.

```
$client = new Spatie\Dropbox\Client($authorizationToken);
```

or alternatively you can implement `Spatie\Dropbox\TokenProvider`which will provide the access-token from its `TokenProvider->getToken(): string` method.

If you use oauth2 to authenticate and to acquire refresh-tokens and access-tokens, (like [thephpleague/oauth2-client](https://github.com/thephpleague/oauth2-client)), you can create an adapter that internally takes care of token-expiration and refreshing tokens, and at runtime will supply the access-token via the `TokenProvider->getToken(): string` method.

*(Dropbox announced they will be moving to short-lived access\_tokens mid 2021).*

```
// implements Spatie\Dropbox\TokenProvider
$tokenProvider = new AutoRefreshingDropBoxTokenService($refreshToken);
$client = new Spatie\Dropbox\Client($tokenProvider);
```

or alternatively you can authenticate as an App using your App Key &amp; Secret.

```
$client = new Spatie\Dropbox\Client([$appKey, $appSecret]);
```

If you only need to access the public endpoints you can instantiate `Spatie\Dropbox\Client` without any arguments.

```
$client = new Spatie\Dropbox\Client();
```

Dropbox Endpoints
-----------------

[](#dropbox-endpoints)

Look in [the source code of `Spatie\Dropbox\Client`](https://github.com/spatie/dropbox-api/blob/master/src/Client.php) to discover the methods you can use.

Here's an example:

```
$content = 'hello, world';
$client->upload('/dropboxpath/filename.txt', $content, $mode='add');

$from = '/dropboxpath/somefile.txt';
$to = '/dropboxpath/archive/somefile.txt';
$client->move($from, $to);
```

If the destination filename already exists, dropbox will throw an Exception with 'to/conflict/file/..'

The `upload()` and `move()` methods have an optional extra 'autorename' argument to try and let dropbox automatically rename the file if there is such a conflict.

Here's an example:

```
$from = '/dropboxpath/somefile.txt';
$to = '/dropboxpath/archive/somefile.txt';
$client->move($from, $to, $autorename=true);
// with autorename results in 'somefile (1).txt'
```

If you do not find your favorite method, you can directly use the `contentEndpointRequest` and `rpcEndpointRequest` functions.

```
public function contentEndpointRequest(string $endpoint, array $arguments, $body): ResponseInterface

public function rpcEndpointRequest(string $endpoint, array $parameters): array
```

Here's an example:

```
$client->rpcEndpointRequest('search', ['path' => '', 'query' => 'bat cave']);
```

If you need to change the subdomain of the endpoint URL used in the API request, you can prefix the endpoint path with `subdomain::`.

Here's an example:

```
$client->rpcEndpointRequest('content::files/get_thumbnail_batch', $parameters);
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you've found a bug regarding security please mail  instead of using the issue tracker.

Postcardware
------------

[](#postcardware)

You're free to use this package (it's [MIT-licensed](LICENSE.md)), but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.

We publish all received postcards [on our company website](https://spatie.be/en/opensource/postcards).

Credits
-------

[](#credits)

- [Alex Vanderbist](https://github.com/AlexVanderbist)
- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1380d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/604a034b6f62e174fd2b2b78bdf77445a27723d21fe909022cb2596b3108f189?d=identicon)[hamidsamak](/maintainers/hamidsamak)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (134 commits)")[![ilamp](https://avatars.githubusercontent.com/u/12907744?v=4)](https://github.com/ilamp "ilamp (28 commits)")[![iget-esoares](https://avatars.githubusercontent.com/u/9450290?v=4)](https://github.com/iget-esoares "iget-esoares (18 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (13 commits)")[![IlFalco1992](https://avatars.githubusercontent.com/u/25423312?v=4)](https://github.com/IlFalco1992 "IlFalco1992 (9 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (9 commits)")[![masbug](https://avatars.githubusercontent.com/u/11191264?v=4)](https://github.com/masbug "masbug (6 commits)")[![Nielsvanpach](https://avatars.githubusercontent.com/u/10651054?v=4)](https://github.com/Nielsvanpach "Nielsvanpach (6 commits)")[![mynameisbogdan](https://avatars.githubusercontent.com/u/707714?v=4)](https://github.com/mynameisbogdan "mynameisbogdan (5 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (5 commits)")[![jmsche](https://avatars.githubusercontent.com/u/3929498?v=4)](https://github.com/jmsche "jmsche (4 commits)")[![srmklive](https://avatars.githubusercontent.com/u/839335?v=4)](https://github.com/srmklive "srmklive (3 commits)")[![akoepcke](https://avatars.githubusercontent.com/u/5311185?v=4)](https://github.com/akoepcke "akoepcke (3 commits)")[![cklingsporn](https://avatars.githubusercontent.com/u/19943672?v=4)](https://github.com/cklingsporn "cklingsporn (3 commits)")[![hajrovica](https://avatars.githubusercontent.com/u/934110?v=4)](https://github.com/hajrovica "hajrovica (3 commits)")[![hamidsamak](https://avatars.githubusercontent.com/u/9208642?v=4)](https://github.com/hamidsamak "hamidsamak (3 commits)")[![iget-master](https://avatars.githubusercontent.com/u/9434959?v=4)](https://github.com/iget-master "iget-master (3 commits)")[![iWader](https://avatars.githubusercontent.com/u/2007548?v=4)](https://github.com/iWader "iWader (3 commits)")[![joaopatrocinio](https://avatars.githubusercontent.com/u/28317418?v=4)](https://github.com/joaopatrocinio "joaopatrocinio (3 commits)")[![mozammil](https://avatars.githubusercontent.com/u/1447522?v=4)](https://github.com/mozammil "mozammil (3 commits)")

---

Tags

dropboxdropbox-apidropbox-apisphpsyncapisyncdropboxv2Dropbox-APIsyncinghamidsamak

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hamidsamak-dropbox-api/health.svg)

```
[![Health](https://phpackages.com/badges/hamidsamak-dropbox-api/health.svg)](https://phpackages.com/packages/hamidsamak-dropbox-api)
```

###  Alternatives

[spatie/dropbox-api

A minimal implementation of Dropbox API v2

3116.0M36](/packages/spatie-dropbox-api)[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[kunalvarma05/dropbox-php-sdk

Dropbox PHP API V2 SDK (Unofficial)

3633.0M18](/packages/kunalvarma05-dropbox-php-sdk)[srmklive/flysystem-dropbox-v2

Flysystem Adapter for Dropbox API v2

20179.1k9](/packages/srmklive-flysystem-dropbox-v2)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
