CodeIgniter Forums
How to load config options into library from model. in Ci4.5 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: How to load config options into library from model. in Ci4.5 (/showthread.php?tid=90978)



How to load config options into library from model. in Ci4.5 - xsPurX - 05-30-2024

I have this from ci2.2 I want to know how I can do this in CI4.5
PHP Code:
        $config = array(
            
'Sandbox' => FALSE
            
'APIUsername' => $pp_username,
            
'APIPassword' => $pp_password
            
'APISignature' => $pp_signature
            
'APISubject' => '',     
            
'APIVersion' => $this->config->item('APIVersion')
        );
        
$this->load->library('paypal/Paypal_pro'$config); 

Thanks


RE: How to load config options into library from model. in Ci4.5 - xsPurX - 05-30-2024

This works, didn't think it would be that easy for some reason lol.

PHP Code:
$config = array(
            
'Sandbox' => FALSE,     
            
'APIUsername' => $pp_username,
            
'APIPassword' => $pp_password,
            
'APISignature' => $pp_signature
            
'APISubject' => '',
            
'APIVersion' => config('Paypal')->APIVersion
        
);
        
$this->Paypal_pro = new Paypal_pro($config);