Skip to content

tilekus/dropbox-v2-php

 
 

Repository files navigation

Average time to resolve an issue Percentage of issues still open Build Status codecov Dependency Status Reference Status HHVM Status

Latest Stable Version Total Downloads License


A PHP SDK for Dropbox's v2 API. If you haven't tried Dropbox out yet, do - it's great!

#Table of Contents

  1. PHP Support
  2. Installation
  3. Usage
  4. Supported API operations
  5. API Documentation

#PHP Support This package will run on PHP 5.6 & 7.0. Travis tests have successfully completed on HHVM.

#Installation Installation is only available via Composer. ##Quick version:

composer require alorel/dropbox-v2-php

##More informed version: The package is still in its 0.x development stage, therefore adding it as a ^ dependency, e.g. "alorel/dropbox-v2-php":"^0.1" will severely limit the amount of updates you receive, as, per semver specification, 0.2 is allowed to be backwards-incompatible with 0.1. While I definitely cannot guarantee full backwards compatibility if you fiddle with protected methods and derive your own subclasses, I do guarantee that the public API will remain backwards-compatible, therefore, if you only use the raw methods in your application e.g.

$options = new UploadOptions(); //set your options
(new Upload())->raw('/file.txt', 'data', $options);

You can safely add the following as a dependency in your composer.json:

{
  "require": {
    "alorel/dropbox-v2-php": ">=0.1 <1.0"
  }
}

Additionally, composer outdated is a useful command to know during the 0.x development stage!

#Usage Every Dropbox API operation is located in the \Alorel\Dropbox\Operation namespace and is a class named after the API endpoint. There are a few exceptions to this, however, e.g. the class for https://content.dropboxapi.com/2/files/upload_session/start is \Alorel\Dropbox\Operation\Files\UploadSession\Start.

All operation classes inherit the AbstractOperation constructor:

  /**
    * Operation constructor.
    *
    * @param bool   $async       Whether requests should be asynchronous
    * @param string $accessToken Our access token
    */
    function __construct($async = null, string $accessToken = null) {}

The first parameter is a boolean determining whether operations should run synchronously or asynchronously (defaults to synchronous), the second is the access token created when the user authorises your application. Both can have default values set via AbstractOperation::setDefaultToken() and AbstractOperation::setDefaultAsync() respectively.

Currently the only supported way of making requests is with the respective operation class' raw method, which will return an instance of PromiseInterface when operating in asynchronous mode or an instance of ResponseInterface if operating in synchronous mode. See guzzlephp.org for more information on promises and responses.

In future releases I will be adding 'management' classes that will automatically format the response.

#Supported API Operations Unless specified otherwise, any operation that is not currently supported will be added in a future release.

Files

All except:

  • /alpha/get_metadata | In Beta/Alpha on Dropbox - will implement once stable
  • /alpha/upload | In Beta/Alpha on Dropbox - will implement once stable
  • /properties/add | In Beta/Alpha on Dropbox - will implement once stable
  • /properties/overwrite | In Beta/Alpha on Dropbox - will implement once stable
  • /properties/remove | In Beta/Alpha on Dropbox - will implement once stable
  • /properties/template/get | In Beta/Alpha on Dropbox - will implement once stable
  • /properties/template/list | In Beta/Alpha on Dropbox - will implement once stable
  • /properties/update | In Beta/Alpha on Dropbox - will implement once stable

Sharing

Currently in building

Users

All

Team

None

#API Documentation 0.3.3 | 0.2 | 0.1.1 | 0.1


Links

About

A PHP SDK for Dropbox's v2 API

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%