Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
anuj9196 authored Jun 20, 2018
1 parent 96e78a8 commit 55acd47
Showing 1 changed file with 106 additions and 5 deletions.
111 changes: 106 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Google Drive Manager
composer require tbetool/google-drive-manager
```

### Permission required
```
https://www.googleapis.com/auth/drive
```

### Initialize
```
$drive = new GoogleDriveManager('client_id', 'client_secret', 'access_token');
Expand All @@ -26,10 +31,16 @@ response will contain
```
[
(int) 0 => [
'id' => '1BEfQmdMja45M3ewc548OhiQLh9or9P6KGpqYECipV6c',
'name' => 'Resume of Anuj Sharma',
'mime_type' => 'application/vnd.google-apps.document',
'kind' => 'drive#file'
'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
],
]
```
Expand All @@ -46,6 +57,7 @@ Response:
'id' => '1YoSEbFDSOejkZmtPmfOyBIoWODhllPjJ',
'name' => 'Selling Digital Items Modules to be updated ',
'kind' => null,
'type' => 'folder',
'created_time' => null,
'file_extension' => null,
'mime_type' => null,
Expand All @@ -61,7 +73,96 @@ Response:
*currently in development*

```
$drive->download('item_id');
$drive->download('item_id', $save_to_path);
```
**save_to_path** should be absolute local path where to save file

Response:
```
[
'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:

```
[
'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

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

Response:
```
[
'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.

Response:
```
[
'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
]
```


0 comments on commit 55acd47

Please sign in to comment.