PHP code example of nikkiii / flysystem-acd

1. Go to this page and download the library: Download nikkiii/flysystem-acd 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/ */

    

nikkiii / flysystem-acd example snippets


use CloudDrive\Cache\SQLite;
use CloudDrive\CloudDrive;
use CloudDrive\Node;
use League\Flysystem\Filesystem;
use Nikkii\Flysystem\ACD\AmazonCloudDrive;

$cache = new SQLite('email', './cache');

$drive = new CloudDrive('email', 'client id', 'secret', $cache);

$response = $drive->getAccount()->authorize();

if (!$response['success']) {
	print_r($response); // Get the URL from here
}

// Input the resulting redirected url
$url = readline();

$response = $drive->getAccount()->authorize($url);

// Initialize Node
Node::init($drive->getAccount(), $cache);

// Sync your local cache with the current state of your Cloud Drive.
$drive->getAccount()->sync();

$flysystem = new Filesystem(new AmazonCloudDrive($drive));

// Access flysystem like usual

use CloudDrive\Cache\SQLite;
use CloudDrive\CloudDrive;
use CloudDrive\Node;
use League\Flysystem\Filesystem;
use Nikkii\Flysystem\ACD\AmazonCloudDrive;

$cache = new SQLite('email', './cache');

$drive = new CloudDrive('email', 'client id', 'secret', $cache);

$response = $drive->getAccount()->authorize();

if (!$response['success']) {
	// Something is wrong
	return;
}

// Initialize Node
Node::init($drive->getAccount(), $cache);

// Sync your local cache with the current state of your Cloud Drive.
$drive->getAccount()->sync();

$flysystem = new Filesystem(new AmazonCloudDrive($drive));

// Access flysystem like usual