I'm a newbie in Laravel, and surely this question has an obvious answer, but I've not been able to connect Laravel 5 with Google Api.
I have install the Api with composer like always, and it is in my vendor folder, but now I'm not sure how to use it.
I've not found an answer to this (because this must be extremely simple).
Probably I'm missing a namespace call, or something like this.
On my IndexController, I have:
<?php
namespace App\Http\Controllers;
class IndexController extends Controller {
/**
* Show the application welcome screen to the user.
*
* @return Response
*/
public function index()
{
$client = new Google_Client();
$client->setApplicationName("Client_Library_Examples");
$client->setDeveloperKey("HERE_GOES_MY_KEY");
$service = new Google_Service_Drive($client);
$results = $service->volumes->listVolumes();
foreach ($results as $item) {
echo $item['volumeInfo']['title'], "<br /> \n";
}
}
}
And the error I get is:
Class 'App\Http\Controllers\Google_Client' not found
I thought that it could be a problem with autoload_classmap, but there are all GoogleApi classes defined, like:
(...)
'Google_Client' => $vendorDir . '/google/apiclient/src/Google/Client.php',
(...)
'Google_Service_Drive' => $vendorDir . '/google/apiclient/src/Google/Service/Drive.php',
Thanks for your patience and your help!