Install Google API PHP Client Without Composer

Viewed 3056

I am trying to do YouTube API calls and I have no idea what folder to upload from the google-api-php-client-2.2.2.zip file.

There is both a "src" and "vendor" folder. Most api call examples do a request to the vendor folder, so I tried uploading this one first.

I then include one the autoload file found in it and the first thing I discover is that "Google_Client" class does not exist. I look everywhere for the file to create it and it's not there. the only file outside of other directories is the "autoload.php", with the "client.php" file missing.

So, I go the other route and upload the "src" directory and include once the "autoload.php" file from that.

This time I get this error:

Uncaught exception 'Exception' with message 'This library must be installed via composer or by downloading the full package. See the instructions at https://github.com/google/google-api-php-client#installation

The only thing this page says is user composer or download the zip I'm having issues with.

What exactly should I upload to my server?

require_once $_SERVER['DOCUMENT_ROOT'] .'/inc/google-api-php-client/autoload.php';
1 Answers

It looks like although you can download the source and pop that in your web application folder, the files still assume you've got composer and it's autoloader in your application. So, on your local dev maching install composer, follow their instructions and that will get the files into your web app, then upload those files to your production site. You're just using composer to get the files and provide it's autoloader. That is the auto loader it's referring to.

Related