• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shared libraries

#1
Hi community,

thank you in advance for your help. We have been using CI2 for many years and are finally getting round to upgrade our main product to CI3. It's all going ok so far, apart from one issue.

Preamble
As we create many websites, the way we have used CI2 is to have one single shared copy of CI2/system and duplicate index.php and application for each project. Any library that was shared between projects was stored in CI2/system/libraries instead of application/libraries, because that avoided redundancies and made our libraries easier to maintain and keep up to date. This included our own libraries, as well as third parties, like GoogleApi or Amazon AWS.

CI3
With CI3, we tried the same, but CI3 does not seem to like it. If we place the GoogleApi library in system/libraries, the loader does not find it. It only finds it if it's in application/libraries. This is not ideal, as we would have many copies of the same library for no purpose and we would need to update all of them.

Is there an alternative?

Thanks
Cristiano
Keepthinking Ltd
Reply

#2
Use Composer. Specify a namespace with directory for psr-4 autoloading in your composer.json file, then run dump-autoload.

This is modern PHP.
Reply

#3
(01-26-2019, 02:00 AM)cbianchi Wrote: Hi community,

thank you in advance for your help. We have been using CI2 for many years and are finally getting round to upgrade our main product to CI3. It's all going ok so far, apart from one issue.

Preamble
As we create many websites, the way we have used CI2 is to have one single shared copy of CI2/system and duplicate index.php and application for each project. Any library that was shared between projects was stored in CI2/system/libraries instead of application/libraries, because that avoided redundancies and made our libraries easier to maintain and keep up to date. This included our own libraries, as well as third parties, like GoogleApi or Amazon AWS.

CI3
With CI3, we tried the same, but CI3 does not seem to like it. If we place the GoogleApi library in system/libraries, the loader does not find it. It only finds it if it's in application/libraries. This is not ideal, as we would have many copies of the same library for no purpose and we would need to update all of them.

Is there an alternative?

Thanks
Cristiano
Keepthinking Ltd

Maybe this could help:

https://forum.codeigniter.com/thread-72726.html

I wrote it because I had practically the same issue.
Reply

#4
Thanks a lot!
Best
Cristiano
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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