![]() |
How to create a new library and use it with controller? - 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 create a new library and use it with controller? (/showthread.php?tid=79101) |
How to create a new library and use it with controller? - sr13579 - 04-19-2021 I am writing a very big application and I think it would be great if i could put that in a library and use it in my controller. How can I easily build up a simple library and use that in my Controller? Care to give me an example? RE: How to create a new library and use it with controller? - InsiteFX - 04-19-2021 Example: PHP Code: <?php RE: How to create a new library and use it with controller? - rich8374 - 12-23-2021 In your controller, use Code: use App\Libraries\ExampleLibrary; and then you can instantiate your library class in a method with Code: $exampleLibrary = new ExampleLibrary(); |