Skip to content

Configuration

Kunal Varma edited this page Jun 29, 2016 · 4 revisions

Configuration

Firstly, the DropboxApp class needs to be configured with the client_id and client_secret obtained from the Dropbox Developer App Dashboard, by creating an Application.

use Kunnu\Dropbox\DropboxApp;

$app = new DropboxApp("client_id", "client_secret");

If you already have an access token, you can pass it to the constructor above as the third argument.

$app = new DropboxApp("client_id", "client_secret", 'access_token');

The Dropbox service class is required to work with the Dropbox API. To configure the Dropbox service class, an instance of the above created DropboxApp needs to be passed as the first parameter.

use Kunnu\Dropbox\Dropbox;

$dropbox = new Dropbox($app);

Advanced Configuration

Quickstart

The usage is quite simple. The Dropbox service class houses all the methods (most of them, for now) needed to interact with the Dropbox API.

use Kunnu\Dropbox\Dropbox;
use Kunnu\Dropbox\DropboxApp;

//Configure Dropbox Application
$app = new DropboxApp("client_id", "client_secret", "access_token");

//Configure Dropbox service
$dropbox = new Dropbox($app);

//Get File Metadata
$fileMetadata = $dropbox->getMetadata("/helloworld.txt");

//File Name
$fileMetadata->getName();

Detailed Usage Guide