• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple application with CI4

#1
Hi,

How to create multiple application with CI4?
Example, other application for admin's and clients.
How to resolve this?
How to execute first and second?

Thanks for help.
Reply

#2
I have a menu of available applications and use a PHP session to remember the current application.

All applications use the same ../CodeIgniter4/system folder.

Check out my signature,
download and make your system directory strict
Reply

#3
Yeah that is good idea, now I switch by get parameter, but saving this to session is much pretty solution.
I think about 'old' solution: segment in url like /admin but with latest CI4 that's not work property (admin segment set as controller).
I need structure multi-applicational like /applications/one1 (inside all Config/Controllers/Filters/Language/Models etc.) and second /applications/one2 (inside all Config/Controllers/Filters/Language/Models etc.) and maybe in future more apps.
Reply

#4
I do not understand your requirements.

As mentioned I used multiple application copies like app_one, app_two, app_three, etc.

Also each application shares common files saved in the "writable" folder.
download and make your system directory strict
Reply

#5
(08-06-2018, 05:42 AM)Przem4S Wrote: I think about 'old' solution: segment in url like /admin but with latest CI4 that's not work property (admin segment set as controller).

Why wouldn't this work currently? It still supports automatically determining controller based on URL so should work just like CI3 did in that respect. Additionally, you can use Route groups to add a prefix to other controllers, if you're specifying all of your routes in the routes file.

(08-06-2018, 05:42 AM)Przem4S Wrote: I need structure multi-applicational like /applications/one1 (inside all Config/Controllers/Filters/Language/Models etc.) and second /applications/one2 (inside all Config/Controllers/Filters/Language/Models etc.) and maybe in future more apps.

Fairly easily done: make multiple copies of the application folder, and rename to whatever apps you have:

Code:
admin/
        Controllers/
        Models/
        etc
    clients/
        Controllers/
        Models/
        etc
    public/
        admin/
            index.php
        clients/
            index.php
    system

This is the safest way to do it, though you could make each a "flat" structure by bringing the public folder along with it.

In the Config\Paths.php file for both applications, adjust to make sure they point to the appropriate directory and the shared system directory.

Either this solution, or the one I mentioned at the top of this post work. If you want to share models, that's pretty easily done by ensuring they are namespaced and both applications know where to find them. Or, just use the route groups, mentioned above, and keep them all in a single application so models, libraries, etc don't need to be duplicated.

Lots of options. Smile
Support Development  • Practical CodeIgniter 3  • Vulcan - CLI Tools for CI4
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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