move options/context related into buildContext to make it more testable
move some codes into composePHPRender, more testable