composer improvements

porting 87959a5c3fe44b3e374634d18660c7d3f7b8a623 to 2.8 branch