How to package original libraries |
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)?
Nobody? I’m actually starting to think this should be a section in the user guide.
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 Check the composer.json file in https://github.com/codeigniter4/framework or https://github.com/codeigniter4/appstarter
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? |
Welcome Guest, Not a member yet? Register Sign In |