Let’s consider about a multi-users blog system.
Each user has a blog which containing its view/post/manager/list features, etc.
We know, these features should share they model/view/controller in source code layer but distinguish by parameters.
For horizontal scaling purpose, we should make it “statusless” or “sessionless”, that’s why we consider to wrap it in REQUEST scope.
For example, we should consider about some factors bellow for our blog system:
2, owner (may the same as visitor or not)
3, blog belongs to owner
4, relationship between the visitor and owner (friends or blocked etc.)
5, special authorizations between visitor and blog (share, allow comment, etc.)
Commonly, 2(userId) and 3(blogId) may be wrapped to request parameters.
After login, we can obtain the $app->user->id of the visitor, and combine 2 and 3 to determine 4 and 5.
The question is that how to wrap the BASIC parameters to REQUEST SCOPE?
They may transported between browser and web application automatically.
The developers should not necessary to care about how to obtain them,
for example, they may simply call the api like $app->current_page->owner->id to obtain the blog owner id.
It’s there some guidance, BEST PRACTICE or extensions?
Any suggestion is appreciated, thanks!