Skip to content

nikkiii/flysystem-acd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Flysystem Adapter for Amazon Cloud Drive

This is an Amazon Cloud Drive adapter for Flysystem.

Installation

Composer is the best way, as with all of Flysystem!

composer require nikkiii/flysystem-acd

Usage

This is a bit tougher, since there's no automated way to authenticate amazon cloud drive. You'll need a client id and secret from Cloud Drive's API, and to manually pass the url into the authorize method on the CloudDrive account object.

Initial setup would be something like this:

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

Repeat usage would be simpler (no authentication url)

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

About

Flysystem adapter for Amazon Cloud Drive

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages