Welcome Guest, Not a member yet? Register   Sign In
Load Composer Modules into Controllers
#1

I use CodeIgniter 3 and I need composer to install some libraries needed for my application, like 2FA token generation, crawler detector, elephant IO, etc.
To use these components I load them at the beginning of the controllers that need it and also in a general purpose helper that I have.

Example:
PHP Code:
<?php
require_once FCPATH '/application/third_party/composer/vendor/autoload.php';
use 
Sinergi\BrowserDetector\Browser;
use 
Sinergi\BrowserDetector\Os;
class 
MyClass extends CI_Controller 

Is this way of working correct or is there some easier and better way to work?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB