Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include 3rd party libraries in CodeIgniter?

Tags:

codeigniter

I'm trying to get Google Plus Authentication into CodeIgniter using the following: https://code.google.com/p/google-api-php-client/

I have put these files in third_party/google-api-php-client/src

If I was doing this without CI, I would simply use:

require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_PlusService.php';

What would be the CI equivalent way to "require" these files? I have tried doing

require APPPATH .'third_party/google-api-php-client/src/Google_Client.php';

However get issued the following message:

Message: require(application/third_party/google-api-php-client/src/Google_Client.php): failed to open stream: Permission denied

like image 771
K20GH Avatar asked Jul 03 '13 17:07

K20GH


People also ask

How to load third party library in CodeIgniter?

Step 1: First download a third party library class. Here we are using simple_html_dom. php. Step 2: Now copy it on CodeIgniter's third party folder located at application\third_party.

Can we load library in model CodeIgniter?

All of the available libraries are located in your system/libraries/ directory. In most cases, to use one of these classes involves initializing it within a controller using the following initialization method: $this->load->library('class_name');

How to auto load library in CodeIgniter 4?

First step is to auto load the library, so edit the file app/Config/Autoload. php file and update the section for psr4 as shown below: public $psr4 = [ APP_NAMESPACE => APPPATH, // For custom app namespace 'Config' => APPPATH . 'Config', "App" => APPPATH, "TCPDF" => "ThirdParty/tcpdf" ];


1 Answers

download the third party library and put it inside your library or third party folder and the same you load your other libraries you can load this as will, check out this way i hope it will work

$this->load->library('phpword');

for third parties. for google api check read out this i hope this will solve your problem https://github.com/joeauty/Google-API-Client-CodeIgniter-Spark

like image 75
MJ X Avatar answered Oct 04 '22 12:10

MJ X