Download the PHP package alex-phillips/clouddrive without Composer
On this page you can find all versions of the php package alex-phillips/clouddrive. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alex-phillips/clouddrive
More information about alex-phillips/clouddrive
Files in alex-phillips/clouddrive
Package clouddrive
Short Description PHP SDK and CLI for Amazon's CloudDrive
License
Informations about the package clouddrive
CloudDrive PHP
NOTE: This project is in active development.
CloudDrive-PHP is an SDK and CLI application for interacting with Amazon's Cloud Drive.
The project originally started out as an application to manage storage in Cloud Drive from the command line but figured other's may want to take advantage of the API calls and develop their own software using it, so I made sure to build the library so it can be built upon and make the CLI application an included tool that could also be used as an example for implementation.
Install
Via Composer (for use in a project)
Install globally to run the CLI from any location (as long as the global composer bin
directory is in your $PATH
).
CLI
Setup
The first run of the CLI needs to authenticate your Amazon Cloud Drive account with the application using your Amazon Cloud Drive credentials. Use the config
command to set these credentials as well as the email associated with your Amazon account.
Once the credentials are set, simply run the init
command. This will provide you with an authentication URL to visit. Paste the URL you are redirected to into the terminal and press enter.
After you have been authenticated, run the sync
command to sync your local cache with the current state of your Cloud Drive.
Usage
The CLI application relies on your local cache being in sync with your Cloud Drive, so run the sync
command periodically to retrieve any changes since the last sync. You can view all available commands and usage of each command using the -h
flag at any point.
SDK
SDK Responses
All of the method calls return a reponse in a REST API-like structure with the exception of those methods that return Node
objects.
Example response:
Every API-like reponse will have at least 2 keys: success
and data
. Success
is a boolean on whether or not the request was completed successfully and the data contains various information related to the request.
NOTE: The response for nodeExists
will return success = true
if the node exists, false
if the node doesn't exist.
Various method calls that return Node
objects such as findNodeByPath
and findNodeById
will return either a Node
object or null
if the node was not found.
Getting started
The first thing to do is create a new CloudDrive
object using the email of the account you wish you talk with and the necessary API credentials for Cloud Drive and a Cache
object for storing local data. (Currently there is only a SQLite cache store).
The first time you go to authorize the account, the response
will "fail" and the data
key in the response will contain an auth_url
. This is required during the initial authorization to grant access to your application with Cloud Drive. Simply navigate to the URL, you will be redirected to a "localhost" URL which will contain the necessary code for access.
Next, call authorization once more with the redirected URL passed in:
The response will now be successful and the access token will be stored in the cache. From now on, when the account needs to renew its authorization, it will do so automatically with its 'refresh token' inside of the authorize
method.
Local Cache
There is currently support for MySQL (and MariaDB) and SQLite3 for the local cache store. Simply instantiate these with the necessary parameters. If you are using MySQL, make sure the database is created. The initialization of the cache store will automatically create the necessary tables.
Node
Once you have authenticated the Account
object and created a local cache, initialize the Node
object to utilize these.
Now all static Node
methods will be available to retrieve, find, and manipulate Node
objects.
Various Node
methods will either return an array if multiple nodes are able to be returned and a Node
object if only 1 is meant to be returned (i.e., lookup by ID). If no nodes are found, then the methods will return an empty array or null
value respectively.
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.
All versions of clouddrive with dependencies
guzzlehttp/guzzle Version ^6.0
alex-phillips/utilities Version ~0.1
cilex/cilex Version ^1.1
j4mie/idiorm Version ^1.5