Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SendInBlue PHP API with Codeigniter

I'm using the Codeigniter framework and trying to integrate with SendInBlue's PHP API. Their PHP documentation is not super helpful and the setup instructions on Github not clear either.

The doc says to "Download the files and include autoload.php":

require_once('/path/to/APIv3-php-library/vendor/autoload.php');

But I cannot find autoload anywhere and I'm not really sure how to include that in my CI structure.

Update:

I contacted Sendinblue support and they do not have any installation tutorial for CI users. I tried using Compiler, and got the folder structure created but I'm still having issues integrating it with CI. I placed all the folders in my Libraries but it is not loaded correctly and complains about Autoload class not existing.

Composer result

like image 496
remyremy Avatar asked Jun 24 '18 18:06

remyremy


1 Answers

To get the autoload.php, you need to use Composer. This will resolve all dependencies and install/update them for you.

If you already have the entire SendInBlue API folder structure in the library location, you can only add in your controller, before class My_Class ... line require_once (APPPATH . 'vendor/autoload.php');

eg.

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

// include manually module library - SendInBlue API
require_once (APPPATH . 'vendor/autoload.php');

class My_Class extends CI_Controller {
....

After that, you can follow the guide from Github: APIv3-php-library - Getting Started

If you get errors, means that your SendInBlue's structure is bad. I recommand you to use Composer

  1. Install Composer if is not installed - Installation - Linux / Unix / OSX or Installation - Windows
  2. Install SendinBlue's API with Composer - Github: APIv3-php-library - Installation & Usage
  3. Add autoload.php in your controller - see the previous example

Please add here the list of errors if you still have issues.

like image 198
vasilenicusor Avatar answered Oct 20 '22 03:10

vasilenicusor