CodeIgniter Forums
How should I handle classes and files on which a Library depends? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: How should I handle classes and files on which a Library depends? (/showthread.php?tid=28094)



How should I handle classes and files on which a Library depends? - El Forum - 03-01-2010

[eluser]kirkryyn[/eluser]
I'm considering writing CI Library wrappers for some non-CI specific libraries. However, I do not know where I should place the dependencies. In Cake, there was a concept of a Vendors directory where outside code could be placed. Is there something for CodeIgniter that I simply missed?

For instance, say I want to create a CI Library to wrap some AWS S3 software that is implemented as several class files. Where should I place those class files and how should I require them from within my CI Library in such a way that it would be easy for the person using the Library to install everything in their system?


How should I handle classes and files on which a Library depends? - El Forum - 03-01-2010

[eluser]tomcode[/eluser]
I usually create a folder 'third_party' inside the application folder.

Including is done via CI's constant APPPATH, (defined in index.php).


How should I handle classes and files on which a Library depends? - El Forum - 03-01-2010

[eluser]kirkryyn[/eluser]
So there is no standardized/supported way to handle this?

I'll look into tomcode's solution as an option.


How should I handle classes and files on which a Library depends? - El Forum - 03-01-2010

[eluser]tomcode[/eluser]
No, there's nothing standardized. As long as You stick with the CI constants APPPATH and BASEPATH Your additions should play nice with any CI installation.