CodeIgniter Forums
How to package original libraries - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: How to package original libraries (/thread-72920.html)



How to package original libraries - MGatner - 02-28-2019

Hi there! Long time lurker and avid CI user since 2.0. I’ve been diving into CI4 recently, and I’m very excited for it! I have a series of five “zero conf” libraries that I wrote and use in almost every CI3 project I’ve ever done. I never released them (though I intended to) but now with the new version coming soon I’m interested in rewriting them and releasing them as CI4 libraries. I’ve already done the first one (Asset loader). I’m ready to test Composer autoload integration but I’m stumped where to start.

I’m hoping someone can recommend a good resource or example repo where I can learn what additional files I need to include to make my source (includes library, config, & helper) Composer-ready? And tips for making it a happy automagic service (it already is when copied into /app but I want it to work on install from /vendor as well)?


RE: How to package original libraries - MGatner - 03-02-2019

Nobody? I’m actually starting to think this should be a section in the user guide.


RE: How to package original libraries - ciadmin - 03-02-2019

https://packagist.org/ *is* the documentation about building packages.
As long as your code is in the right namespace, eg App/Something, then it should be found if your package is composer-installed.
That is composer magic, not CI Undecided

Check the composer.json file in https://github.com/codeigniter4/framework or https://github.com/codeigniter4/appstarter


RE: How to package original libraries - MGatner - 03-04-2019

Thanks @ciadmin! That's the part I was looking for - that namespaced files will be available immediately after composer installation.
Any suggestion for Helpers, since those aren't named spaced? I usually use them as easy-access wrappers, kind of like the "services"... is creating my own service now preferable to un-namespaced helper functions?