Tjorriemorrie Tjorriemorrie - 10 months ago 73
PHP Question

How to use composer packages in codeigniter?

I've followed this article:

But I get

Fatal error: Class 'Buzz\Browser' not found

What is missing from his post?

My controller or application isn't namespaced. I was hoping to just be able to use that one package in one controller's action in a non-namespaced framework.

Answer Source

Credit to @jmadsen

This is possible by just getting the order of loading correct:

 * --------------------------------------------------------------------
 * --------------------------------------------------------------------
 * And away we go...
// Composer Autoloader
require FCPATH . 'vendor/autoload.php';

require_once BASEPATH.'core/CodeIgniter.php';

/* End of file index.php */