Mosh
Mosh

Reputation: 101

Google api php client

I'm trying to implement the google analytics API on localhost site using xampp on Mac OS.

but Im getting this error:

Fatal error: Uncaught Exception: 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. in /Applications/XAMPP/xamppfiles/htdocs/ga-api/google-api-php-client/autoload.php:14 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/ga-api/index.php(4): require_once() #1 {main} thrown in /Applications/XAMPP/xamppfiles/htdocs/ga-api/google-api-php-client/autoload.php on line 14

Can anyone help me with this?

Upvotes: 0

Views: 1646

Answers (1)

Oluwafemi Sule
Oluwafemi Sule

Reputation: 38922

Given that you installed the library using Composer, it will be installed to vendor and will be available in the autoload.php that Composer generates.

I will require_once DIR. '/vendor/autoload.php'; in index.php (preferred) or where I need to instantiate the GoogleClient class.

Ensure that the path to client credentials are rightly referenced when you set auth config like so: Google_Client->setAuthConfig($pathToCredentials)

Reference:

Upvotes: 0

Related Questions