library googledrivetree
Compiles into an array a Google Drive Folder into a treelike structure.
divinityfound/googledrivetree
Compiles into an array a Google Drive Folder into a treelike structure.
- Monday, October 19, 2015
- by Divinityfound
- Repository
- 1 Watchers
- 0 Stars
- 125 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 0 % Grown
Google Drive Tree
Google Drive to an Array Tree
This solution was developed to make it easier for developers to figure out the entirety of the Google Drive file map for public or private use., (*1)
Google Setup
- Visit https://console.developers.google.com/project
- Create a project.
- On the menu on the left, expand "APIs & auth", select APIs
- Select under Google Apps APIs, Drive API
- Enable API
- On the menu on the left under "APIs & auth", select Credentials
- Under OAuth, click "Create new Client ID"
- Click Service Account, select P12 Key
- Store your P12 Key somewhere safe
- Visit https://admin.google.com
- Click "Security". It may be under Show More.
- Click Show More when in Security, click Advanced Settings.
- Click Manage "API client access"
- Insert Service Account's Client Id under Client Name, insert into API Scope "https://www.googleapis.com/auth/drive"
- Your API is now set up!
Code
require_once(__DIR__ . '/../vendor/autoload.php');
$params = array();
$params['client_id'] = 'xyz.apps.googleusercontent.com';
$params['service_account_name'] = 'xyz@developer.gserviceaccount.com';
$params['key'] = 'your_directory.P12';
$params['sub'] = 'youremail@example.com';
$params['drive'] = 'drive_folder';
$data = new \Divinityfound\GoogleDriveTree\Processor($params);
echo '<pre>';
print_r($data->file_tree);
echo '</pre>';
exit;
dev-master
9999999-dev
Compiles into an array a Google Drive Folder into a treelike structure.
Sources
Download
The Requires
by
Jacob Mathison