CodeIgniter Forums
How to make a Helper/Service that would be included with composer and autoloaded? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: How to make a Helper/Service that would be included with composer and autoloaded? (/showthread.php?tid=86261)



How to make a Helper/Service that would be included with composer and autoloaded? - Rinart - 01-24-2023

I'm in the process of making a Library (a single php class atm) that handles some document-related stuff. I'm also adding a Helper that allows for quick access to some of the Library features (mainly to use inside views). I know how to add and use Libraries, Helpers and Services.

But if I post my Library + Helper + Service config on the github and then request it in another new project with composer (which will put it in "vendor/myname/mylibrary/"), how do I make so the "helper" function in the new project will also look into my library /Helpers/ folder and that my library Service config would be merged with both CodeIgniter and the new app configs so the "service('library')" would work out of the box?


RE: How to make a Helper/Service that would be included with composer and autoloaded? - kenjis - 01-24-2023

Read https://codeigniter4.github.io/CodeIgniter4/general/modules.html

By default, these are automatically discovered.