I want to use the Google Drive API in my Laravel project to store PDFs. Unfortunately, the example code is for common PHP and I don't know how could I implement it in Laravel.
<?php
require_once 'Google/Client.php';
require_once 'Google/Service/Books.php';
$client = new Google_Client();
$client->setApplicationName("Client_Library_Examples");
$client->setDeveloperKey("YOUR_APP_KEY");
$service = new Google_Service_Books($client);
$optParams = array('filter' => 'free-ebooks');
$results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);
foreach ($results as $item) {
echo $item['volumeInfo']['title'], "<br /> \n";
}
I guess that I have to include https://github.com/google/google-api-php-client in my dependencies, but I don't know how can I acces to the functions of the API.
Can anybody help me?
Greetings and thanks.
Laravel utilises Composer to handle dependencies. Add
google/apiclient
as a dependency in your composer.json file.For login + file upload on drive (https://github.com/google/google-api-php-client/blob/master/examples/large-file-upload.php)