PHP code example of graham-campbell / dropbox

1. Go to this page and download the library: Download graham-campbell/dropbox 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/ */

    

graham-campbell / dropbox example snippets


        'Dropbox' => GrahamCampbell\Dropbox\Facades\Dropbox::class,

use GrahamCampbell\Dropbox\Facades\Dropbox;
// you can alias this in config/app.php if you like

Dropbox::createFolder('foo');
// we're done here - how easy was that, it just works!

Dropbox::delete('foo');
// this example is simple, and there are far more methods available

use GrahamCampbell\Dropbox\Facades\Dropbox;

// the alternative connection is the other example provided in the default config
// let's create a copy ref so we can copy a file to the main connection
$ref = Dropbox::connection('alternative')->createCopyRef('foo');

// let's copy the file over to the other connection
// note that using the connection method here is optional
Dropbox::connection('main')->copyFromCopyRef($ref, 'bar');

use GrahamCampbell\Dropbox\Facades\Dropbox;

// writing this:
Dropbox::connection('main')->createFolder('foo');

// is identical to writing this:
Dropbox::createFolder('foo');

// and is also identical to writing this:
Dropbox::connection()->createFolder('foo');

// this is because the main connection is configured to be the default
Dropbox::getDefaultConnection(); // this will return main

// we can change the default connection
Dropbox::setDefaultConnection('alternative'); // the default is now alternative

use GrahamCampbell\Dropbox\DropboxManager;
use Illuminate\Support\Facades\App; // you probably have this aliased already

class Foo
{
    protected $dropbox;

    public function __construct(DropboxManager $dropbox)
    {
        $this->dropbox = $dropbox;
    }

    public function bar()
    {
        $this->dropbox->createFolder('foo');
    }
}

App::make('Foo')->bar();
bash
$ php artisan vendor:publish