Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Decoupling frontend/backend MVC, sharing the same core


I wonder if I could do what topic says.

To be more clear. I have an in-house CMS, what we did is that we have 2 separate folders, /frontend and /backend, one is more rendering to user, the other is for admin panel, they even reside on a different server if you wish, but they all share the same core functionality and vendor packages in /shared

Is it something I can achieve with Phalcon?

Having (assuming default MVC structure for Phalcon):


And of course, having different URLs for it. is no good.

I thought just creating the folders like that and defining 2 different VHOSTS, anything else I missed on this case?

Thanks for help!

edited Feb '14

I have a very similar situation. I solved this by creating namespace Company/Common and have all core models services and other classes in this namespace.

Yeah, but your files are still coupled and you cannot separate them physically in case of a need. That's bad design.

I have few instances that works with the same codebase loaded with composer packages. If I change something in Common I just need to deploy it with git pull & composer install on every server. If you don't like composer you can write your own php extension with zephir.

I love composer, but Not sure I know how to do it (load codebase with composer packages). Any tips on that?