Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to load google api php client library in codeigniter

when i use APPPATH.'libraries/Google/Client.php', all the files which are included in require_once, the sub file i.e(Auth/AssertionCredentials.php)

A PHP Error was encountered

Severity: Warning

Message: require_once(Google/Auth/AssertionCredentials.php): failed to open stream: No such file or directory

Filename: Google/Client.php

Line Number: 18
like image 424
Rohit Avatar asked Jun 17 '14 11:06

Rohit


1 Answers

Copy the "Google" folder to third_party.

Create new file under application/library called google.php

<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
set_include_path(APPPATH . 'third_party/' . PATH_SEPARATOR . get_include_path());
require_once APPPATH . 'third_party/Google/Client.php';

class Google extends Google_Client {
    function __construct($params = array()) {
        parent::__construct();
    }
} 

Then to use:

$this->load->library('google');
echo $this->google->getLibraryVersion();  
like image 138
Gaurav Gupta Avatar answered Sep 24 '22 21:09

Gaurav Gupta