1. Go to this page and download the library: Download fnsc/laravel-google-drive library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fnsc / laravel-google-drive example snippets
use LaravelGoogleDrive\GoogleDrive;
use Illuminate\Http\Request;
Route::post('/upload', function (Request $request, GoogleDrive $drive) {
$result = $drive->upload($request->file('file'));
return [
'file_id' => $result->getFileId(),
'file_name' => $result->getFileName(),
'folder_id' => $result->getFolderId(),
];
});