PHP code example of hamidsamak / dropbox-api

1. Go to this page and download the library: Download hamidsamak/dropbox-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hamidsamak / dropbox-api example snippets


$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);

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

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

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

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

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

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

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

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

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

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

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