FrontEnd si BackEnd - as different apps
No. As @armababy suggested, the asgard app is the api. So you other app calls the API. This is how apis work.
Basically you have 1 core CMS application located anywhere accessible trough network that your WWW app can see.
This way you have separation and you can scale any of the sides, also you potentially could have multiple WWW applications using same CMS api.
In your case on both sides you configure applications to use same database. All you have to do now is to develop your API be it soap or rest.
Asgard already have some groundwork laid down to structure for API controllers.
Requesting from WWW using something like
Guzzleor straight up
CURLor any other REST client(lets assume you go with rest api) while authenticating using
JW Authwould work very nicely.
I know how a HTTP API works. I do no see why a php APP should conect to mysql through HTTP calls. Why can't we use PHP models that already the framework has?
You don't seem to know since you're asking this.
Apis: You have ONE api app that connects to the DB. Other apps call that ONE api app. that's it.
Please read up on how APIs work, thank you.
@nWidart I have no idea what are you talking about. So you are not talking about api over HTTP ? Because I saw writing about JWT auth. Those tokens are not for wiring over http? Sorry for miss interpreting your message
I am talking about calls over http yes.
@nWidart OK. So why do say I do not know how HTTP API works? For me it looks to be a little overhead as you you have two php apps that can read MySQL directly
That's how apis work.
If you duplicate the models of app1 in app2, you will be able to access the same data, yes. But you have a ton of duplicate business logic moving around.
That is why the API approach is much better in the long run. If you don't want or need the jwt overhead that's a very valid point too. You can just have an api that doesn't require authentication, and secure the server for outside connections instead.
@nWidart So know I know for sure that the CMS wasn't build in the way I was asking. You are right about the code duplicationm, usually read models should be different than write models (like a CQRS flavor).
Tx for all the patiance
@TheLionKing you shouldn't really have two separate apps that use code (i.e. Models) from one of the two apps, this is why @nWidart is suggesting you use an API, so that one of your app is the central source of all of your data, and the other app simply consumes it.