2017 © Pedro Peláez
 

library copy

Copy PHP library

image

nao-pon/copy

Copy PHP library

  • Tuesday, January 19, 2016
  • by nao-pon
  • Repository
  • 1 Watchers
  • 0 Stars
  • 51 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 10 Forks
  • 0 Open issues
  • 19 Versions
  • 0 % Grown

The README.md

Copy PHP API

Build Status Latest Stable Version Total Downloads License Code Coverage Scrutinizer Code Quality, (*1)

A php library for communicating with the copy cloud api, (*2)

This library demos the binary part api, an efficient way to de-dupe and send/receive data with the Copy cloud, and the JSONRPC api used by the Copy agent, and Copy mobile devices, for doing advanced things with Copy., (*3)

This demo works with the OAUTH api, which you will need to setup at the Copy developer portal (https://www.copy.com/developer/)., (*4)

Please check out our changelog to see what has changed between versions., (*5)

The Basics

Connect to the cloud

// create a cloud api connection to Copy
$copy = new \Barracuda\Copy\API($consumerKey, $consumerSecret, $accessToken, $tokenSecret);

List items

// list items in the root
$items = $copy->listPath('/');

Uploading a file

// open a file to upload
$fh = fopen('/tmp/file', 'rb');

// upload the file in 1MB chunks
$parts = array();
while ($data = fread($fh, 1024 * 1024)) {
    $part = $copy->sendData($data);
    array_push($parts, $part);
}

// close the file
fclose($fh);

// finalize the file
$copy->createFile('/copy-file-path', $parts);

Downloading a file

// obtain a list of files and parts
$files = $copy->listPath('/copy-file-path', array("include_parts" => true));

// process each file
foreach ($files as $file) {
    $data = '';

    // enumerate the parts in the latest revision
    foreach ($file->revisions[0]->parts as $part) {
        $data .= $copy->getPart($part->fingerprint, $part->size);
    }
}

Delete a file

$copy->removeFile('/copy-file-path');

Rename an object

$copy->rename('/source-copy-file-path', '/destination-copy-file-path');

Installing via Composer

The recommended way to install the Copy PHP API is through Composer., (*6)

# Install Composer
curl -sS https://getcomposer.org/installer | php

# Add Copy API as a dependency
php composer.phar require barracuda/copy

After installing, you need to require Composer's autoloader:, (*7)

require 'vendor/autoload.php';

Running the tests

First install the dependencies for the library using Composer. See above for how to install Composer., (*8)

composer install

Then add connection info for your Copy account as environment variables:, (*9)

export CONSUMER_KEY=<check the developer portal>
export CONSUMER_SECRET=<check the developer portal>
export ACCESS_TOKEN=<OAuth token>
export ACCESS_TOKEN_SECRET=<OAuth secret>

License

This library is MIT licensed, so feel free to use it anyway you see fit., (*10)

The Versions

19/01 2016

dev-pilot

dev-pilot https://github.com/nao-pon/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

 

The Development Requires

copy

19/01 2016

dev-wakeup

dev-wakeup https://github.com/copy-app/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

 

The Development Requires

copy

27/05 2015

dev-master

9999999-dev https://github.com/copy-app/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

 

The Development Requires

copy

05/03 2015

dev-patch-4

dev-patch-4 https://github.com/copy-app/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

 

The Development Requires

copy

26/02 2015
07/02 2015

dev-patch-3

dev-patch-3 https://github.com/copy-app/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

 

The Development Requires

copy

06/02 2015

dev-rest_meta

dev-rest_meta https://github.com/copy-app/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

 

The Development Requires

copy

06/02 2015

dev-patch-2

dev-patch-2 https://github.com/copy-app/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

 

The Development Requires

copy

06/02 2015

dev-patch-1

dev-patch-1 https://github.com/copy-app/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

 

The Development Requires

copy

31/08 2014

dev-php-parallel-lint

dev-php-parallel-lint https://github.com/copy-app/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

 

The Development Requires

copy

31/08 2014

dev-scrutinizer-cleanup

dev-scrutinizer-cleanup https://github.com/copy-app/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

 

The Development Requires

copy

30/08 2014

dev-rest

dev-rest https://github.com/copy-app/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

 

The Development Requires

copy

30/08 2014

1.1.4

1.1.4.0 https://github.com/copy-app/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

 

The Development Requires

copy

29/08 2014

1.1.3

1.1.3.0 https://github.com/copy-app/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

 

The Development Requires

copy

26/08 2014

1.1.2

1.1.2.0 https://github.com/copy-app/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

 

The Development Requires

copy

24/08 2014

1.1.1

1.1.1.0 https://github.com/copy-app/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

 

The Development Requires

copy

10/08 2014

1.1.0

1.1.0.0 https://github.com/copy-app/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

 

The Development Requires

copy

03/03 2014

1.0.1

1.0.1.0 https://github.com/copy-app/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

 

The Development Requires

copy

05/01 2014

1.0.0

1.0.0.0 https://github.com/copy-app/php-client-library

Copy PHP library

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *
  • ext-json *
  • ext-oauth *

 

The Development Requires

copy