Welcome Guest, Not a member yet? Register   Sign In
Sharing things between CI4 instances
#1

For a number of reasons, I'm toying with a "split app setup". There are basically three separate and isolated CI4 "instances" or "installations" serving the same platform. One is used for signing up/registering, one is used for logging in, and one is used once you're actually logged in.

There are obviously things these "instances" have in common, code being the most obvious item, and in some cases also data from databases.

I would like to keep them separated, but allow for "code sharing". Is there an official/recommended way of doing this, without having verbatim copies of each class, etc. in each instance of the "app"?

-joho
Reply
#2

If you create Composer packages, you can share the code easily.
https://codeigniter4.github.io/CodeIgnit...kages.html

You don't need to publish your packages at packagist.org.
You can use private packages.
Reply
#3

(03-27-2024, 01:01 AM)kenjis Wrote: If you create Composer packages, you can share the code easily.
https://codeigniter4.github.io/CodeIgnit...kages.html

You don't need to publish your packages at packagist.org.
You can use private packages.

Thank you, that's a great suggestion, and probably good practice too.

But while developing, I'd prefer a more "live" sharing setup, like a "Super Global Includes" or "Super Global Helpers"; basically so that I do not have to update composer packages for the other two "instances" when I update stuff in "the package".

I mean, in theory, this could be done by just using use/require_once/etc and then just have a "shared folder structure", but I was wondering if there was an "official way" of doing it :-)

-joho
Reply
#4

Do you mean that you want to have only one repository?
Then, like this:
https://codeigniter4.github.io/CodeIgnit...stallation
and use Code Modules:
https://codeigniter4.github.io/CodeIgnit...dules.html
Reply
#5

(03-27-2024, 01:30 AM)kenjis Wrote: Do you mean that you want to have only one repository?
Then, like this:
https://codeigniter4.github.io/CodeIgnit...stallation
and use Code Modules:
https://codeigniter4.github.io/CodeIgnit...dules.html

Exactly like that! I knew there would be some proper way of doing this Smile  Thank you!

-joho
Reply




Theme © iAndrew 2016 - Forum software by © MyBB