CI Way of Using Own Classes / Code |
What you are doing above is a good start. You have to reference the full path name to any class that you want to instantiate with new().
If you use composer then you can load your classes or APIs in this way: use PhpOffice\PhpWord; use PhpOffice\Common; Lonnie Ezell's book gives an overview of using composer in codeigniter: https://leanpub.com/practicalcodeigniter3 Codeigniter classes are singletons and so are any classes that inherit from them. Passing in a reference to the $CI class is not a bad practice but it does couple your classes to the CI framework. If your class has to reference any of the CI framework services then you need to reference it in some way. |
Messages In This Thread |
CI Way of Using Own Classes / Code - by JustBoo - 02-17-2017, 10:41 AM
RE: CI Way of Using Own Classes / Code - by Shawn - 02-18-2017, 09:58 AM
RE: CI Way of Using Own Classes / Code - by JustBoo - 02-19-2017, 11:49 AM
RE: CI Way of Using Own Classes / Code - by marksman - 02-19-2017, 01:58 PM
RE: CI Way of Using Own Classes / Code - by codevil - 08-22-2019, 12:04 AM
|