I have installed codeigniter 3.1.8 and installed this library https://github.com/php-amqplib/php-amqplib using composer:
composer require php-amqplib/php-amqplib
This has created a directory vendor
I have looked the accepted answer on how to use the library here How to use composer packages in codeigniter?
but this is my directory structure in vendor.
second
and inside php-amqplib
and inside php-amqplib
If i look at index.php
i find that fcpath has already been defined
// Path to the front controller (this file) directory
define('FCPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
require_once BASEPATH.'core/CodeIgniter.php';
and defining it again will result in an error.How can i get to use php-amqplib inside my controller methods?.
IF your question is - How can i get to use php-amqplib inside my controller methods ?
STEP - 1 :Allow or require the autoload.php file on very beginning, but on codeigniter you cannot do that in general.So change one line on config file that will automatically require
autoload.php
file.CodeIgniter/application/config/config.php
find :
STEP - 2 :$config['composer_autoload'] = FALSE;
to$config['composer_autoload'] = TRUE;
On your controller class like this :
STEP - 3 :Now you can call it via URL
Now more
ref:
PhpAmqpLib