Google API v2.0.2


I have a problem with Yii2 + Google API v2.0.2 on the Linux server

I have installed the library via Composer in my local machine and on the server.

I’m using prefix ‘\’ to load the class

$client = new \Google_Client();


$analytics = new \Google_Service_Analytics($client);

It worked on my machine, but when I deploy it, it gave me error

exception ‘yii\base\ErrorException’ with message ‘Class ‘Google_Utils_UriTemplate’ not found’ in


Looks like the autoload is not working, but I’m not 100% sure that is the problem or how to debug it

Hope someone in the forum can help me

Thank you!

What is minimum-stability setting in your composer.json and what version of google/apiclient do you require there?

Can you call Google_Utils_UriTemplate from within your controller? Like $a = new \Google_Utils_UriTemplate(); ?

I’m using v2.0 google apiclient “google/apiclient”: “^2.0”

I can call the class like $a = new \Google_Utils_UriTemplate(); from my controller, but Resource.php doesnt have that backslash

Can you check if

composer clearcache

composer selfupdate

composer update

fixes the problem? Like in this report.