Sorry, was too quick: the archive exclude attribute doesn't work for packages that are downloaded via Packagist from Github. Because the zip (archive) that is downloaded is made by Git. The files and directories to be excluded are therefore listed in .gitattributes with the export-ignore command.
In the Joomla-Framework packages we have a .gitignore. containing:
We should probably just put the files and directories in it we don't want to downloadwith composer.
For Dopctrine2 ORM https://github.com/doctrine/doctrine2/blob/master/.gitattributes has this content: