Welcome Guest, Not a member yet? Register   Sign In
Accsess my Libraries from Models
#2

There's no difference in loading a library from a controller or from a model. You can create a new instance of your class the standard PHP way:
PHP Code:
$myLib = new MyLib(); 

Or you can define a service. This allows to get a shared instance if you need to access your library in multiple places, instead of creating a new object everytime.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply


Messages In This Thread
Accsess my Libraries from Models - by Anton_BNV - 09-01-2021, 05:04 AM
RE: Accsess my Libraries from Models - by includebeer - 09-05-2021, 04:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB