We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Multiple apps communicating with each other

Hi - I would like to have multiple apps working independently, but still able to communicate with each other. For example - I have an app that takes care of user authentication, roles, permissions, etc. Then I have an app that logs information to serveral tables.

I would like the info logging app use the authentication app to ensure the user is valid, and has correct permissions. (and other apps the same). I know I could use a rest api or something like that, but that still involves an http call. I would like to "include" one app within the other, and yet be able to configure each one separately, use different dbs etc.

Any ideas?

I've gotten it somewhat working by registering the namespaces of the user auth app in the logging app, but that doesn't allow separate configuration files.

Thanks! -Seth

You can have a multiple boostrap files and that's all.

If you wanna achieve security, when you are trying to share models and controllers and separate one application from another your way is a bad practice. But if you need something like this, you need to build modular application, something like git submodules, that will be building on each machine.



7.9k

for what point you seperate auth, role, permission, etc into different application? all you need is application pattern, try DDD (domain design development) it might can solve your problem



14.9k

Essentially I'm trying to cut down on code duplication. I have several independent apps that use the same user auth db. I could have the user auth code running in each app, but it seems excessive.

Say you're compiling php -- you pass specific lib directories: ./configure -with-zlib-dir=/usr/lib/whatever. Don't need multiple copies of zlip floating around.

Maybe the multi-module stuff is the best way to go, but just need to figure out how to make it work with legacy code at the same time.

Thanks for your replies.