We're developing an Yii2 php appliction, which can be seen as a AirBNB clone for sake of simplicity. I'm trying to devide the application into modules, but keep getting ugly dependencies no matter how I twist or try. Couple of examples:
How can we keep this kind of things decoupled?
For anybody looking at the same problem, I currently solved it by keeping every strictly decoupled. Modules can either make a call to a custom made WidgetRequester, which sees is a requested widget exists in another module, and returns it if it does, which solves the problem of pages with multiple module dependencies (an item page with a booking form i.e.).
Modules can also trigger normal Yii events, which can be picked up by other modules in their Bootstrap file, and process the events to their own liking.