![]() |
Dependency Management in Custom Services - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12) +--- Thread: Dependency Management in Custom Services (/showthread.php?tid=92640) |
Dependency Management in Custom Services - campio97 - 03-21-2025 Hello If I create a custom service, is it considered good practice to load models and other libraries/services directly within the service itself?Or is it better to pass all these instances from the controller when calling the service? For example, if I have a service that requires 6 models and 3 other services or libraries, should I pass them all through the constructor? Thank you ![]() RE: Dependency Management in Custom Services - InsiteFX - 03-21-2025 This may help you. Lonnie Ezell - Dependecy Injection in CodeIgniter 4 Lonnie Ezell - Services in CodeIgniter 4 |