• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to package original libraries

#1
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)?
Reply

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

#3
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
Reply

#4
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?
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.