2017 © Pedro Peláez
 

library google-drive-manager

Based on Google PHP SDK. Enables using upload and download to Google Drive.

image

tbetool/google-drive-manager

Based on Google PHP SDK. Enables using upload and download to Google Drive.

  • Wednesday, June 20, 2018
  • by anuj9196
  • Repository
  • 2 Watchers
  • 1 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Google Drive Manager

Google Drive Manager, (*1)

Install

composer require tbetool/google-drive-manager

Permission required

https://www.googleapis.com/auth/drive

Initialize

$drive = new GoogleDriveManager('client_id', 'client_secret', 'access_token');

set access token

$drive->setAccessToken('access_token');

List items from folder

$response = $drive->listFolder();
Response

response will contain, (*2)

[
    (int) 0 => [
        'id' => '1YoSEbFDSOejkZmtPmfOyBIoWODhllPjJ',
        'name' => 'Selling Digital Items Modules to be updated ',
        'kind' => null,
        'type' => 'folder',
        'created_time' => null,
        'file_extension' => null,
        'mime_type' => null,
        'modified_time' => null,
        'original_filename' => null,
        'size' => null
    ],
]

Search for item

$drive->search('query');

Response:, (*3)

[
    (int) 0 => [
        'id' => '1YoSEbFDSOejkZmtPmfOyBIoWODhllPjJ',
        'name' => 'Selling Digital Items Modules to be updated ',
        'kind' => null,
        'type' => 'folder',
        'created_time' => null,
        'file_extension' => null,
        'mime_type' => null,
        'modified_time' => null,
        'original_filename' => null,
        'size' => null
    ],
]

download file

currently in development, (*4)

$drive->download('item_id', $save_to_path);

save_to_path should be absolute local path where to save file, (*5)

Response:, (*6)

[
    'id' => '1lJNyeIx5BpyK88Vj31YFG6WVVNY_g9Hj',
    'name' => 'file.zip',
    'kind' => 'drive#file',
    'type' => 'application/zip',
    'created_time' => null,
    'file_extension' => null,
    'mime_type' => 'application/zip',
    'modified_time' => null,
    'original_filename' => null,
    'size' => null,
    'download_path' => '/home/path/to/local/save/to/file.zip'
]

create folder

$drive->createFolder('folder name', $parent_folder_id);

if $parent_folder_id is not provided, folder will be created in root folder Response:, (*7)

[
    'id' => '1Q6fozdc2JK32HO2nimSKz1lQ0AVxl413',
    'name' => 'New Folder 123',
    'kind' => 'drive#file',
    'type' => 'folder',
    'created_time' => null,
    'file_extension' => null,
    'mime_type' => 'application/vnd.google-apps.folder',
    'modified_time' => null,
    'original_filename' => null,
    'size' => null
]

upload file to folder

$drive->upload('file/path/', $folder_id);

file_path must be absolute path of local file, (*8)

if folder_id is not provided, file will be uploaded to root folder, (*9)

Response:, (*10)

[
    'id' => '1Q6fozdc2JK32HO2nimSKz1lQ0AVxl413',
    'name' => 'New Folder 123',
    'kind' => 'drive#file',
    'type' => 'folder',
    'created_time' => null,
    'file_extension' => null,
    'mime_type' => 'application/vnd.google-apps.folder',
    'modified_time' => null,
    'original_filename' => null,
    'size' => null
]

move file to another folder

$drive->move($file_id, $folder_id);

both file_id and folder_id are required., (*11)

Response:, (*12)

[
    'id' => '1Q6fozdc2JK32HO2nimSKz1lQ0AVxl413',
    'name' => 'New Folder 123',
    'kind' => 'drive#file',
    'type' => 'folder',
    'created_time' => null,
    'file_extension' => null,
    'mime_type' => 'application/vnd.google-apps.folder',
    'modified_time' => null,
    'original_filename' => null,
    'size' => null
]

The Versions

20/06 2018

dev-master

9999999-dev http://anujsh.in

Based on Google PHP SDK. Enables using upload and download to Google Drive.

  Sources   Download

The Requires

 

google drive the born engineer anuj sharma tbe anuj tbe google-php-sdk drive-sdk-php drive-php-service

20/06 2018

1.1

1.1.0.0 http://anujsh.in

Based on Google PHP SDK. Enables using upload and download to Google Drive.

  Sources   Download

The Requires

 

google drive the born engineer anuj sharma tbe anuj tbe google-php-sdk drive-sdk-php drive-php-service

20/06 2018

1.0.1

1.0.1.0 http://anujsh.in

Based on Google PHP SDK. Enables using upload and download to Google Drive.

  Sources   Download

The Requires

 

google drive the born engineer anuj sharma tbe anuj tbe google-php-sdk drive-sdk-php drive-php-service

19/06 2018

1.0

1.0.0.0 http://anujsh.in

Based on Google PHP SDK. Enables using upload and download to Google Drive.

  Sources   Download

The Requires

 

google drive the born engineer anuj sharma tbe anuj tbe google-php-sdk drive-sdk-php drive-php-service