I\'m new in composer development. I just start to work with composer in my current project. And I think my question is already asked before or I\'m noob about composer :D
There is a plugin to do exactly that: composer cleanup. The author warns that the package is experimental, so be careful.