CodeIgniter Forums
Packages - Replacing Native Libraries - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: Packages - Replacing Native Libraries (/showthread.php?tid=1570)



Packages - Replacing Native Libraries - ircdirk - 03-22-2015

As i load third_party package which have third_party/{some package name}/libraries/Profiler.php in it, it does not replace native profiler library.

Is this behaviour intended?


RE: Packages - Replacing Native Libraries - sotavento - 03-23-2015

I think you can't overwrite core libaries with 'third-party' directory.

In the CI 3 doc :

Quote:Replacing Native Libraries with Your Versions
Simply by naming your class files identically to a native library will cause CodeIgniter to use it instead of the native one. To use this feature you must name the file and the class declaration exactly the same as the native library. For example, to replace the native Email library you’ll create a file named application/libraries/Email.php

http://www.codeigniter.com/userguide3/general/creating_libraries.html

I had the same problem and rewrite my library profiler in application/libraries/Profiler.php. Now, everything works fine.


RE: Packages - Replacing Native Libraries - ircdirk - 03-23-2015

I'have analyzed Loader.php and Replacing Native Libraries only works in APPPATH/libraries.

But the question is should packages have ability to overwrite native libraries? This would be usefull, as we could write packages that may overwrite every aspect of CI and use them between many CI apps... What do u think?